EmbASP-CSharp
DLVParser.cs
1 //------------------------------------------------------------------------------
2 // <auto-generated>
3 // This code was generated by a tool.
4 // ANTLR Version: 4.7
5 //
6 // Changes to this file may cause incorrect behavior and will be lost if
7 // the code is regenerated.
8 // </auto-generated>
9 //------------------------------------------------------------------------------
10 
11 // Generated from DLVParser.g4 by ANTLR 4.7
12 
13 // Unreachable code detected
14 #pragma warning disable 0162
15 // The variable '...' is assigned but its value is never used
16 #pragma warning disable 0219
17 // Missing XML comment for publicly visible type or member '...'
18 #pragma warning disable 1591
19 // Ambiguous reference in cref attribute
20 #pragma warning disable 419
21 
22 using System;
23 using System.IO;
24 using System.Text;
25 using System.Diagnostics;
26 using System.Collections.Generic;
27 using Antlr4.Runtime;
28 using Antlr4.Runtime.Atn;
29 using Antlr4.Runtime.Misc;
30 using Antlr4.Runtime.Tree;
31 using DFA = Antlr4.Runtime.Dfa.DFA;
32 
33 [System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7")]
34 [System.CLSCompliant(false)]
35 public partial class DLVParser : Parser {
36  protected static DFA[] decisionToDFA;
37  protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
38  public const int
39  HEADER=1, COLON=2, COST_BEGIN=3, COST_END=4, OPEN_SQUARE_BRACKET=5, CLOSE_SQUARE_BRACKET=6,
40  GROUND_QUERY_BEGIN=7, MODEL_BEGIN=8, MODEL_END=9, WEIGHTED_MODEL_LABEL=10,
41  COMMA=11, IDENTIFIER=12, INTEGER_CONSTANT=13, STRING_CONSTANT=14, TERMS_BEGIN=15,
42  TERMS_END=16, WHITESPACE=17, REASONING=18, DOT=19, BOOLEAN=20, WHITESPACE_IN_GROUND_QUERY=21,
43  WITNESS_LABEL=22;
44  public const int
45  RULE_answer_set = 0, RULE_cost = 1, RULE_cost_level = 2, RULE_model = 3,
46  RULE_output = 4, RULE_predicate = 5, RULE_term = 6, RULE_witness = 7;
47  public static readonly string[] ruleNames = {
48  "answer_set", "cost", "cost_level", "model", "output", "predicate", "term",
49  "witness"
50  };
51 
52  private static readonly string[] _LiteralNames = {
53  null, null, "':'", "'Cost ([Weight:Level]): <'", "'>'", "'['", "']'",
54  "' is '", "'{'", "'}'", "'Best model:'", "','", null, null, null, "'('",
55  "')'", null, null, "'.'", null, null, "', evidenced by'"
56  };
57  private static readonly string[] _SymbolicNames = {
58  null, "HEADER", "COLON", "COST_BEGIN", "COST_END", "OPEN_SQUARE_BRACKET",
59  "CLOSE_SQUARE_BRACKET", "GROUND_QUERY_BEGIN", "MODEL_BEGIN", "MODEL_END",
60  "WEIGHTED_MODEL_LABEL", "COMMA", "IDENTIFIER", "INTEGER_CONSTANT", "STRING_CONSTANT",
61  "TERMS_BEGIN", "TERMS_END", "WHITESPACE", "REASONING", "DOT", "BOOLEAN",
62  "WHITESPACE_IN_GROUND_QUERY", "WITNESS_LABEL"
63  };
64  public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);
65 
66  [NotNull]
67  public override IVocabulary Vocabulary
68  {
69  get
70  {
71  return DefaultVocabulary;
72  }
73  }
74 
75  public override string GrammarFileName { get { return "DLVParser.g4"; } }
76 
77  public override string[] RuleNames { get { return ruleNames; } }
78 
79  public override string SerializedAtn { get { return new string(_serializedATN); } }
80 
81  static DLVParser() {
82  decisionToDFA = new DFA[_ATN.NumberOfDecisions];
83  for (int i = 0; i < _ATN.NumberOfDecisions; i++) {
84  decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
85  }
86  }
87 
88  public DLVParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
89 
90  public DLVParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
91  : base(input, output, errorOutput)
92  {
93  Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
94  }
95  public partial class Answer_setContext : ParserRuleContext {
96  public Answer_setContext(ParserRuleContext parent, int invokingState)
97  : base(parent, invokingState)
98  {
99  }
100  public override int RuleIndex { get { return RULE_answer_set; } }
101 
102  public Answer_setContext() { }
103  public virtual void CopyFrom(Answer_setContext context) {
104  base.CopyFrom(context);
105  }
106  }
107  public partial class SimpleModelContext : Answer_setContext {
108  public ModelContext model() {
109  return GetRuleContext<ModelContext>(0);
110  }
111  public SimpleModelContext(Answer_setContext context) { CopyFrom(context); }
112  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
113  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
114  if (typedVisitor != null) return typedVisitor.VisitSimpleModel(this);
115  else return visitor.VisitChildren(this);
116  }
117  }
118  public partial class GroundQueryContext : Answer_setContext {
119  public ITerminalNode[] IDENTIFIER() { return GetTokens(DLVParser.IDENTIFIER); }
120  public ITerminalNode IDENTIFIER(int i) {
121  return GetToken(DLVParser.IDENTIFIER, i);
122  }
123  public ITerminalNode GROUND_QUERY_BEGIN() { return GetToken(DLVParser.GROUND_QUERY_BEGIN, 0); }
124  public ITerminalNode REASONING() { return GetToken(DLVParser.REASONING, 0); }
125  public ITerminalNode BOOLEAN() { return GetToken(DLVParser.BOOLEAN, 0); }
126  public ITerminalNode DOT() { return GetToken(DLVParser.DOT, 0); }
127  public WitnessContext witness() {
128  return GetRuleContext<WitnessContext>(0);
129  }
130  public ITerminalNode[] COMMA() { return GetTokens(DLVParser.COMMA); }
131  public ITerminalNode COMMA(int i) {
132  return GetToken(DLVParser.COMMA, i);
133  }
134  public GroundQueryContext(Answer_setContext context) { CopyFrom(context); }
135  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
136  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
137  if (typedVisitor != null) return typedVisitor.VisitGroundQuery(this);
138  else return visitor.VisitChildren(this);
139  }
140  }
141  public partial class WeightedModelContext : Answer_setContext {
142  public ModelContext model() {
143  return GetRuleContext<ModelContext>(0);
144  }
145  public CostContext cost() {
146  return GetRuleContext<CostContext>(0);
147  }
148  public ITerminalNode WEIGHTED_MODEL_LABEL() { return GetToken(DLVParser.WEIGHTED_MODEL_LABEL, 0); }
149  public WeightedModelContext(Answer_setContext context) { CopyFrom(context); }
150  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
151  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
152  if (typedVisitor != null) return typedVisitor.VisitWeightedModel(this);
153  else return visitor.VisitChildren(this);
154  }
155  }
156  public partial class NonGroundQueryContext : Answer_setContext {
157  public TermContext[] term() {
158  return GetRuleContexts<TermContext>();
159  }
160  public TermContext term(int i) {
161  return GetRuleContext<TermContext>(i);
162  }
163  public ITerminalNode[] COMMA() { return GetTokens(DLVParser.COMMA); }
164  public ITerminalNode COMMA(int i) {
165  return GetToken(DLVParser.COMMA, i);
166  }
167  public NonGroundQueryContext(Answer_setContext context) { CopyFrom(context); }
168  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
169  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
170  if (typedVisitor != null) return typedVisitor.VisitNonGroundQuery(this);
171  else return visitor.VisitChildren(this);
172  }
173  }
174 
175  [RuleVersion(0)]
176  public Answer_setContext answer_set() {
177  Answer_setContext _localctx = new Answer_setContext(Context, State);
178  EnterRule(_localctx, 0, RULE_answer_set);
179  int _la;
180  try {
181  State = 46;
182  ErrorHandler.Sync(this);
183  switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) {
184  case 1:
185  _localctx = new GroundQueryContext(_localctx);
186  EnterOuterAlt(_localctx, 1);
187  {
188  State = 16; Match(IDENTIFIER);
189  State = 21;
190  ErrorHandler.Sync(this);
191  _la = TokenStream.LA(1);
192  while (_la==COMMA) {
193  {
194  {
195  State = 17; Match(COMMA);
196  State = 18; Match(IDENTIFIER);
197  }
198  }
199  State = 23;
200  ErrorHandler.Sync(this);
201  _la = TokenStream.LA(1);
202  }
203  State = 24; Match(GROUND_QUERY_BEGIN);
204  State = 25; Match(REASONING);
205  State = 26; Match(BOOLEAN);
206  State = 29;
207  ErrorHandler.Sync(this);
208  switch (TokenStream.LA(1)) {
209  case DOT:
210  {
211  State = 27; Match(DOT);
212  }
213  break;
214  case WITNESS_LABEL:
215  {
216  State = 28; witness();
217  }
218  break;
219  default:
220  throw new NoViableAltException(this);
221  }
222  }
223  break;
224  case 2:
225  _localctx = new SimpleModelContext(_localctx);
226  EnterOuterAlt(_localctx, 2);
227  {
228  State = 31; model();
229  }
230  break;
231  case 3:
232  _localctx = new NonGroundQueryContext(_localctx);
233  EnterOuterAlt(_localctx, 3);
234  {
235  State = 32; term();
236  State = 37;
237  ErrorHandler.Sync(this);
238  _la = TokenStream.LA(1);
239  while (_la==COMMA) {
240  {
241  {
242  State = 33; Match(COMMA);
243  State = 34; term();
244  }
245  }
246  State = 39;
247  ErrorHandler.Sync(this);
248  _la = TokenStream.LA(1);
249  }
250  }
251  break;
252  case 4:
253  _localctx = new WeightedModelContext(_localctx);
254  EnterOuterAlt(_localctx, 4);
255  {
256  State = 41;
257  ErrorHandler.Sync(this);
258  _la = TokenStream.LA(1);
259  if (_la==WEIGHTED_MODEL_LABEL) {
260  {
261  State = 40; Match(WEIGHTED_MODEL_LABEL);
262  }
263  }
264 
265  State = 43; model();
266  State = 44; cost();
267  }
268  break;
269  }
270  }
271  catch (RecognitionException re) {
272  _localctx.exception = re;
273  ErrorHandler.ReportError(this, re);
274  ErrorHandler.Recover(this, re);
275  }
276  finally {
277  ExitRule();
278  }
279  return _localctx;
280  }
281 
282  public partial class CostContext : ParserRuleContext {
283  public ITerminalNode COST_BEGIN() { return GetToken(DLVParser.COST_BEGIN, 0); }
284  public Cost_levelContext[] cost_level() {
285  return GetRuleContexts<Cost_levelContext>();
286  }
287  public Cost_levelContext cost_level(int i) {
288  return GetRuleContext<Cost_levelContext>(i);
289  }
290  public ITerminalNode COST_END() { return GetToken(DLVParser.COST_END, 0); }
291  public ITerminalNode[] COMMA() { return GetTokens(DLVParser.COMMA); }
292  public ITerminalNode COMMA(int i) {
293  return GetToken(DLVParser.COMMA, i);
294  }
295  public CostContext(ParserRuleContext parent, int invokingState)
296  : base(parent, invokingState)
297  {
298  }
299  public override int RuleIndex { get { return RULE_cost; } }
300  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
301  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
302  if (typedVisitor != null) return typedVisitor.VisitCost(this);
303  else return visitor.VisitChildren(this);
304  }
305  }
306 
307  [RuleVersion(0)]
308  public CostContext cost() {
309  CostContext _localctx = new CostContext(Context, State);
310  EnterRule(_localctx, 2, RULE_cost);
311  int _la;
312  try {
313  EnterOuterAlt(_localctx, 1);
314  {
315  State = 48; Match(COST_BEGIN);
316  State = 49; cost_level();
317  State = 54;
318  ErrorHandler.Sync(this);
319  _la = TokenStream.LA(1);
320  while (_la==COMMA) {
321  {
322  {
323  State = 50; Match(COMMA);
324  State = 51; cost_level();
325  }
326  }
327  State = 56;
328  ErrorHandler.Sync(this);
329  _la = TokenStream.LA(1);
330  }
331  State = 57; Match(COST_END);
332  }
333  }
334  catch (RecognitionException re) {
335  _localctx.exception = re;
336  ErrorHandler.ReportError(this, re);
337  ErrorHandler.Recover(this, re);
338  }
339  finally {
340  ExitRule();
341  }
342  return _localctx;
343  }
344 
345  public partial class Cost_levelContext : ParserRuleContext {
346  public ITerminalNode OPEN_SQUARE_BRACKET() { return GetToken(DLVParser.OPEN_SQUARE_BRACKET, 0); }
347  public ITerminalNode[] INTEGER_CONSTANT() { return GetTokens(DLVParser.INTEGER_CONSTANT); }
348  public ITerminalNode INTEGER_CONSTANT(int i) {
349  return GetToken(DLVParser.INTEGER_CONSTANT, i);
350  }
351  public ITerminalNode COLON() { return GetToken(DLVParser.COLON, 0); }
352  public ITerminalNode CLOSE_SQUARE_BRACKET() { return GetToken(DLVParser.CLOSE_SQUARE_BRACKET, 0); }
353  public Cost_levelContext(ParserRuleContext parent, int invokingState)
354  : base(parent, invokingState)
355  {
356  }
357  public override int RuleIndex { get { return RULE_cost_level; } }
358  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
359  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
360  if (typedVisitor != null) return typedVisitor.VisitCost_level(this);
361  else return visitor.VisitChildren(this);
362  }
363  }
364 
365  [RuleVersion(0)]
366  public Cost_levelContext cost_level() {
367  Cost_levelContext _localctx = new Cost_levelContext(Context, State);
368  EnterRule(_localctx, 4, RULE_cost_level);
369  try {
370  EnterOuterAlt(_localctx, 1);
371  {
372  State = 59; Match(OPEN_SQUARE_BRACKET);
373  State = 60; Match(INTEGER_CONSTANT);
374  State = 61; Match(COLON);
375  State = 62; Match(INTEGER_CONSTANT);
376  State = 63; Match(CLOSE_SQUARE_BRACKET);
377  }
378  }
379  catch (RecognitionException re) {
380  _localctx.exception = re;
381  ErrorHandler.ReportError(this, re);
382  ErrorHandler.Recover(this, re);
383  }
384  finally {
385  ExitRule();
386  }
387  return _localctx;
388  }
389 
390  public partial class ModelContext : ParserRuleContext {
391  public ITerminalNode MODEL_BEGIN() { return GetToken(DLVParser.MODEL_BEGIN, 0); }
392  public ITerminalNode MODEL_END() { return GetToken(DLVParser.MODEL_END, 0); }
393  public PredicateContext[] predicate() {
394  return GetRuleContexts<PredicateContext>();
395  }
396  public PredicateContext predicate(int i) {
397  return GetRuleContext<PredicateContext>(i);
398  }
399  public ITerminalNode[] COMMA() { return GetTokens(DLVParser.COMMA); }
400  public ITerminalNode COMMA(int i) {
401  return GetToken(DLVParser.COMMA, i);
402  }
403  public ModelContext(ParserRuleContext parent, int invokingState)
404  : base(parent, invokingState)
405  {
406  }
407  public override int RuleIndex { get { return RULE_model; } }
408  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
409  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
410  if (typedVisitor != null) return typedVisitor.VisitModel(this);
411  else return visitor.VisitChildren(this);
412  }
413  }
414 
415  [RuleVersion(0)]
416  public ModelContext model() {
417  ModelContext _localctx = new ModelContext(Context, State);
418  EnterRule(_localctx, 6, RULE_model);
419  int _la;
420  try {
421  EnterOuterAlt(_localctx, 1);
422  {
423  State = 65; Match(MODEL_BEGIN);
424  State = 74;
425  ErrorHandler.Sync(this);
426  _la = TokenStream.LA(1);
427  if (_la==IDENTIFIER) {
428  {
429  State = 66; predicate();
430  State = 71;
431  ErrorHandler.Sync(this);
432  _la = TokenStream.LA(1);
433  while (_la==COMMA) {
434  {
435  {
436  State = 67; Match(COMMA);
437  State = 68; predicate();
438  }
439  }
440  State = 73;
441  ErrorHandler.Sync(this);
442  _la = TokenStream.LA(1);
443  }
444  }
445  }
446 
447  State = 76; Match(MODEL_END);
448  }
449  }
450  catch (RecognitionException re) {
451  _localctx.exception = re;
452  ErrorHandler.ReportError(this, re);
453  ErrorHandler.Recover(this, re);
454  }
455  finally {
456  ExitRule();
457  }
458  return _localctx;
459  }
460 
461  public partial class OutputContext : ParserRuleContext {
462  public Answer_setContext[] answer_set() {
463  return GetRuleContexts<Answer_setContext>();
464  }
465  public Answer_setContext answer_set(int i) {
466  return GetRuleContext<Answer_setContext>(i);
467  }
468  public OutputContext(ParserRuleContext parent, int invokingState)
469  : base(parent, invokingState)
470  {
471  }
472  public override int RuleIndex { get { return RULE_output; } }
473  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
474  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
475  if (typedVisitor != null) return typedVisitor.VisitOutput(this);
476  else return visitor.VisitChildren(this);
477  }
478  }
479 
480  [RuleVersion(0)]
481  public OutputContext output() {
482  OutputContext _localctx = new OutputContext(Context, State);
483  EnterRule(_localctx, 8, RULE_output);
484  int _la;
485  try {
486  EnterOuterAlt(_localctx, 1);
487  {
488  State = 81;
489  ErrorHandler.Sync(this);
490  _la = TokenStream.LA(1);
491  while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << OPEN_SQUARE_BRACKET) | (1L << MODEL_BEGIN) | (1L << WEIGHTED_MODEL_LABEL) | (1L << IDENTIFIER) | (1L << INTEGER_CONSTANT) | (1L << STRING_CONSTANT))) != 0)) {
492  {
493  {
494  State = 78; answer_set();
495  }
496  }
497  State = 83;
498  ErrorHandler.Sync(this);
499  _la = TokenStream.LA(1);
500  }
501  }
502  }
503  catch (RecognitionException re) {
504  _localctx.exception = re;
505  ErrorHandler.ReportError(this, re);
506  ErrorHandler.Recover(this, re);
507  }
508  finally {
509  ExitRule();
510  }
511  return _localctx;
512  }
513 
514  public partial class PredicateContext : ParserRuleContext {
515  public ITerminalNode IDENTIFIER() { return GetToken(DLVParser.IDENTIFIER, 0); }
516  public ITerminalNode TERMS_BEGIN() { return GetToken(DLVParser.TERMS_BEGIN, 0); }
517  public TermContext[] term() {
518  return GetRuleContexts<TermContext>();
519  }
520  public TermContext term(int i) {
521  return GetRuleContext<TermContext>(i);
522  }
523  public ITerminalNode TERMS_END() { return GetToken(DLVParser.TERMS_END, 0); }
524  public ITerminalNode[] COMMA() { return GetTokens(DLVParser.COMMA); }
525  public ITerminalNode COMMA(int i) {
526  return GetToken(DLVParser.COMMA, i);
527  }
528  public PredicateContext(ParserRuleContext parent, int invokingState)
529  : base(parent, invokingState)
530  {
531  }
532  public override int RuleIndex { get { return RULE_predicate; } }
533  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
534  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
535  if (typedVisitor != null) return typedVisitor.VisitPredicate(this);
536  else return visitor.VisitChildren(this);
537  }
538  }
539 
540  [RuleVersion(0)]
541  public PredicateContext predicate() {
542  PredicateContext _localctx = new PredicateContext(Context, State);
543  EnterRule(_localctx, 10, RULE_predicate);
544  int _la;
545  try {
546  EnterOuterAlt(_localctx, 1);
547  {
548  State = 84; Match(IDENTIFIER);
549  State = 96;
550  ErrorHandler.Sync(this);
551  _la = TokenStream.LA(1);
552  if (_la==TERMS_BEGIN) {
553  {
554  State = 85; Match(TERMS_BEGIN);
555  State = 86; term();
556  State = 91;
557  ErrorHandler.Sync(this);
558  _la = TokenStream.LA(1);
559  while (_la==COMMA) {
560  {
561  {
562  State = 87; Match(COMMA);
563  State = 88; term();
564  }
565  }
566  State = 93;
567  ErrorHandler.Sync(this);
568  _la = TokenStream.LA(1);
569  }
570  State = 94; Match(TERMS_END);
571  }
572  }
573 
574  }
575  }
576  catch (RecognitionException re) {
577  _localctx.exception = re;
578  ErrorHandler.ReportError(this, re);
579  ErrorHandler.Recover(this, re);
580  }
581  finally {
582  ExitRule();
583  }
584  return _localctx;
585  }
586 
587  public partial class TermContext : ParserRuleContext {
588  public ITerminalNode IDENTIFIER() { return GetToken(DLVParser.IDENTIFIER, 0); }
589  public ITerminalNode INTEGER_CONSTANT() { return GetToken(DLVParser.INTEGER_CONSTANT, 0); }
590  public PredicateContext predicate() {
591  return GetRuleContext<PredicateContext>(0);
592  }
593  public ITerminalNode OPEN_SQUARE_BRACKET() { return GetToken(DLVParser.OPEN_SQUARE_BRACKET, 0); }
594  public ITerminalNode CLOSE_SQUARE_BRACKET() { return GetToken(DLVParser.CLOSE_SQUARE_BRACKET, 0); }
595  public TermContext[] term() {
596  return GetRuleContexts<TermContext>();
597  }
598  public TermContext term(int i) {
599  return GetRuleContext<TermContext>(i);
600  }
601  public ITerminalNode[] COMMA() { return GetTokens(DLVParser.COMMA); }
602  public ITerminalNode COMMA(int i) {
603  return GetToken(DLVParser.COMMA, i);
604  }
605  public ITerminalNode STRING_CONSTANT() { return GetToken(DLVParser.STRING_CONSTANT, 0); }
606  public TermContext(ParserRuleContext parent, int invokingState)
607  : base(parent, invokingState)
608  {
609  }
610  public override int RuleIndex { get { return RULE_term; } }
611  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
612  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
613  if (typedVisitor != null) return typedVisitor.VisitTerm(this);
614  else return visitor.VisitChildren(this);
615  }
616  }
617 
618  [RuleVersion(0)]
619  public TermContext term() {
620  TermContext _localctx = new TermContext(Context, State);
621  EnterRule(_localctx, 12, RULE_term);
622  int _la;
623  try {
624  State = 114;
625  ErrorHandler.Sync(this);
626  switch ( Interpreter.AdaptivePredict(TokenStream,13,Context) ) {
627  case 1:
628  EnterOuterAlt(_localctx, 1);
629  {
630  State = 98; Match(IDENTIFIER);
631  }
632  break;
633  case 2:
634  EnterOuterAlt(_localctx, 2);
635  {
636  State = 99; Match(INTEGER_CONSTANT);
637  }
638  break;
639  case 3:
640  EnterOuterAlt(_localctx, 3);
641  {
642  State = 100; predicate();
643  }
644  break;
645  case 4:
646  EnterOuterAlt(_localctx, 4);
647  {
648  State = 101; Match(OPEN_SQUARE_BRACKET);
649  State = 110;
650  ErrorHandler.Sync(this);
651  _la = TokenStream.LA(1);
652  if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << OPEN_SQUARE_BRACKET) | (1L << IDENTIFIER) | (1L << INTEGER_CONSTANT) | (1L << STRING_CONSTANT))) != 0)) {
653  {
654  State = 102; term();
655  State = 107;
656  ErrorHandler.Sync(this);
657  _la = TokenStream.LA(1);
658  while (_la==COMMA) {
659  {
660  {
661  State = 103; Match(COMMA);
662  State = 104; term();
663  }
664  }
665  State = 109;
666  ErrorHandler.Sync(this);
667  _la = TokenStream.LA(1);
668  }
669  }
670  }
671 
672  State = 112; Match(CLOSE_SQUARE_BRACKET);
673  }
674  break;
675  case 5:
676  EnterOuterAlt(_localctx, 5);
677  {
678  State = 113; Match(STRING_CONSTANT);
679  }
680  break;
681  }
682  }
683  catch (RecognitionException re) {
684  _localctx.exception = re;
685  ErrorHandler.ReportError(this, re);
686  ErrorHandler.Recover(this, re);
687  }
688  finally {
689  ExitRule();
690  }
691  return _localctx;
692  }
693 
694  public partial class WitnessContext : ParserRuleContext {
695  public ITerminalNode WITNESS_LABEL() { return GetToken(DLVParser.WITNESS_LABEL, 0); }
696  public ModelContext model() {
697  return GetRuleContext<ModelContext>(0);
698  }
699  public WitnessContext(ParserRuleContext parent, int invokingState)
700  : base(parent, invokingState)
701  {
702  }
703  public override int RuleIndex { get { return RULE_witness; } }
704  public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
705  IDLVParserVisitor<TResult> typedVisitor = visitor as IDLVParserVisitor<TResult>;
706  if (typedVisitor != null) return typedVisitor.VisitWitness(this);
707  else return visitor.VisitChildren(this);
708  }
709  }
710 
711  [RuleVersion(0)]
712  public WitnessContext witness() {
713  WitnessContext _localctx = new WitnessContext(Context, State);
714  EnterRule(_localctx, 14, RULE_witness);
715  try {
716  EnterOuterAlt(_localctx, 1);
717  {
718  State = 116; Match(WITNESS_LABEL);
719  State = 117; model();
720  }
721  }
722  catch (RecognitionException re) {
723  _localctx.exception = re;
724  ErrorHandler.ReportError(this, re);
725  ErrorHandler.Recover(this, re);
726  }
727  finally {
728  ExitRule();
729  }
730  return _localctx;
731  }
732 
733  private static char[] _serializedATN = {
734  '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786',
735  '\x5964', '\x3', '\x18', 'z', '\x4', '\x2', '\t', '\x2', '\x4', '\x3',
736  '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4',
737  '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b',
738  '\x4', '\t', '\t', '\t', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\a',
739  '\x2', '\x16', '\n', '\x2', '\f', '\x2', '\xE', '\x2', '\x19', '\v', '\x2',
740  '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2',
741  '\x5', '\x2', ' ', '\n', '\x2', '\x3', '\x2', '\x3', '\x2', '\x3', '\x2',
742  '\x3', '\x2', '\a', '\x2', '&', '\n', '\x2', '\f', '\x2', '\xE', '\x2',
743  ')', '\v', '\x2', '\x3', '\x2', '\x5', '\x2', ',', '\n', '\x2', '\x3',
744  '\x2', '\x3', '\x2', '\x3', '\x2', '\x5', '\x2', '\x31', '\n', '\x2',
745  '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\a', '\x3', '\x37',
746  '\n', '\x3', '\f', '\x3', '\xE', '\x3', ':', '\v', '\x3', '\x3', '\x3',
747  '\x3', '\x3', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4', '\x3', '\x4',
748  '\x3', '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x3', '\x5',
749  '\x3', '\x5', '\a', '\x5', 'H', '\n', '\x5', '\f', '\x5', '\xE', '\x5',
750  'K', '\v', '\x5', '\x5', '\x5', 'M', '\n', '\x5', '\x3', '\x5', '\x3',
751  '\x5', '\x3', '\x6', '\a', '\x6', 'R', '\n', '\x6', '\f', '\x6', '\xE',
752  '\x6', 'U', '\v', '\x6', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3',
753  '\a', '\x3', '\a', '\a', '\a', '\\', '\n', '\a', '\f', '\a', '\xE', '\a',
754  '_', '\v', '\a', '\x3', '\a', '\x3', '\a', '\x5', '\a', '\x63', '\n',
755  '\a', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b',
756  '\x3', '\b', '\x3', '\b', '\a', '\b', 'l', '\n', '\b', '\f', '\b', '\xE',
757  '\b', 'o', '\v', '\b', '\x5', '\b', 'q', '\n', '\b', '\x3', '\b', '\x3',
758  '\b', '\x5', '\b', 'u', '\n', '\b', '\x3', '\t', '\x3', '\t', '\x3', '\t',
759  '\x3', '\t', '\x2', '\x2', '\n', '\x2', '\x4', '\x6', '\b', '\n', '\f',
760  '\xE', '\x10', '\x2', '\x2', '\x2', '\x84', '\x2', '\x30', '\x3', '\x2',
761  '\x2', '\x2', '\x4', '\x32', '\x3', '\x2', '\x2', '\x2', '\x6', '=', '\x3',
762  '\x2', '\x2', '\x2', '\b', '\x43', '\x3', '\x2', '\x2', '\x2', '\n', 'S',
763  '\x3', '\x2', '\x2', '\x2', '\f', 'V', '\x3', '\x2', '\x2', '\x2', '\xE',
764  't', '\x3', '\x2', '\x2', '\x2', '\x10', 'v', '\x3', '\x2', '\x2', '\x2',
765  '\x12', '\x17', '\a', '\xE', '\x2', '\x2', '\x13', '\x14', '\a', '\r',
766  '\x2', '\x2', '\x14', '\x16', '\a', '\xE', '\x2', '\x2', '\x15', '\x13',
767  '\x3', '\x2', '\x2', '\x2', '\x16', '\x19', '\x3', '\x2', '\x2', '\x2',
768  '\x17', '\x15', '\x3', '\x2', '\x2', '\x2', '\x17', '\x18', '\x3', '\x2',
769  '\x2', '\x2', '\x18', '\x1A', '\x3', '\x2', '\x2', '\x2', '\x19', '\x17',
770  '\x3', '\x2', '\x2', '\x2', '\x1A', '\x1B', '\a', '\t', '\x2', '\x2',
771  '\x1B', '\x1C', '\a', '\x14', '\x2', '\x2', '\x1C', '\x1F', '\a', '\x16',
772  '\x2', '\x2', '\x1D', ' ', '\a', '\x15', '\x2', '\x2', '\x1E', ' ', '\x5',
773  '\x10', '\t', '\x2', '\x1F', '\x1D', '\x3', '\x2', '\x2', '\x2', '\x1F',
774  '\x1E', '\x3', '\x2', '\x2', '\x2', ' ', '\x31', '\x3', '\x2', '\x2',
775  '\x2', '!', '\x31', '\x5', '\b', '\x5', '\x2', '\"', '\'', '\x5', '\xE',
776  '\b', '\x2', '#', '$', '\a', '\r', '\x2', '\x2', '$', '&', '\x5', '\xE',
777  '\b', '\x2', '%', '#', '\x3', '\x2', '\x2', '\x2', '&', ')', '\x3', '\x2',
778  '\x2', '\x2', '\'', '%', '\x3', '\x2', '\x2', '\x2', '\'', '(', '\x3',
779  '\x2', '\x2', '\x2', '(', '\x31', '\x3', '\x2', '\x2', '\x2', ')', '\'',
780  '\x3', '\x2', '\x2', '\x2', '*', ',', '\a', '\f', '\x2', '\x2', '+', '*',
781  '\x3', '\x2', '\x2', '\x2', '+', ',', '\x3', '\x2', '\x2', '\x2', ',',
782  '-', '\x3', '\x2', '\x2', '\x2', '-', '.', '\x5', '\b', '\x5', '\x2',
783  '.', '/', '\x5', '\x4', '\x3', '\x2', '/', '\x31', '\x3', '\x2', '\x2',
784  '\x2', '\x30', '\x12', '\x3', '\x2', '\x2', '\x2', '\x30', '!', '\x3',
785  '\x2', '\x2', '\x2', '\x30', '\"', '\x3', '\x2', '\x2', '\x2', '\x30',
786  '+', '\x3', '\x2', '\x2', '\x2', '\x31', '\x3', '\x3', '\x2', '\x2', '\x2',
787  '\x32', '\x33', '\a', '\x5', '\x2', '\x2', '\x33', '\x38', '\x5', '\x6',
788  '\x4', '\x2', '\x34', '\x35', '\a', '\r', '\x2', '\x2', '\x35', '\x37',
789  '\x5', '\x6', '\x4', '\x2', '\x36', '\x34', '\x3', '\x2', '\x2', '\x2',
790  '\x37', ':', '\x3', '\x2', '\x2', '\x2', '\x38', '\x36', '\x3', '\x2',
791  '\x2', '\x2', '\x38', '\x39', '\x3', '\x2', '\x2', '\x2', '\x39', ';',
792  '\x3', '\x2', '\x2', '\x2', ':', '\x38', '\x3', '\x2', '\x2', '\x2', ';',
793  '<', '\a', '\x6', '\x2', '\x2', '<', '\x5', '\x3', '\x2', '\x2', '\x2',
794  '=', '>', '\a', '\a', '\x2', '\x2', '>', '?', '\a', '\xF', '\x2', '\x2',
795  '?', '@', '\a', '\x4', '\x2', '\x2', '@', '\x41', '\a', '\xF', '\x2',
796  '\x2', '\x41', '\x42', '\a', '\b', '\x2', '\x2', '\x42', '\a', '\x3',
797  '\x2', '\x2', '\x2', '\x43', 'L', '\a', '\n', '\x2', '\x2', '\x44', 'I',
798  '\x5', '\f', '\a', '\x2', '\x45', '\x46', '\a', '\r', '\x2', '\x2', '\x46',
799  'H', '\x5', '\f', '\a', '\x2', 'G', '\x45', '\x3', '\x2', '\x2', '\x2',
800  'H', 'K', '\x3', '\x2', '\x2', '\x2', 'I', 'G', '\x3', '\x2', '\x2', '\x2',
801  'I', 'J', '\x3', '\x2', '\x2', '\x2', 'J', 'M', '\x3', '\x2', '\x2', '\x2',
802  'K', 'I', '\x3', '\x2', '\x2', '\x2', 'L', '\x44', '\x3', '\x2', '\x2',
803  '\x2', 'L', 'M', '\x3', '\x2', '\x2', '\x2', 'M', 'N', '\x3', '\x2', '\x2',
804  '\x2', 'N', 'O', '\a', '\v', '\x2', '\x2', 'O', '\t', '\x3', '\x2', '\x2',
805  '\x2', 'P', 'R', '\x5', '\x2', '\x2', '\x2', 'Q', 'P', '\x3', '\x2', '\x2',
806  '\x2', 'R', 'U', '\x3', '\x2', '\x2', '\x2', 'S', 'Q', '\x3', '\x2', '\x2',
807  '\x2', 'S', 'T', '\x3', '\x2', '\x2', '\x2', 'T', '\v', '\x3', '\x2',
808  '\x2', '\x2', 'U', 'S', '\x3', '\x2', '\x2', '\x2', 'V', '\x62', '\a',
809  '\xE', '\x2', '\x2', 'W', 'X', '\a', '\x11', '\x2', '\x2', 'X', ']', '\x5',
810  '\xE', '\b', '\x2', 'Y', 'Z', '\a', '\r', '\x2', '\x2', 'Z', '\\', '\x5',
811  '\xE', '\b', '\x2', '[', 'Y', '\x3', '\x2', '\x2', '\x2', '\\', '_', '\x3',
812  '\x2', '\x2', '\x2', ']', '[', '\x3', '\x2', '\x2', '\x2', ']', '^', '\x3',
813  '\x2', '\x2', '\x2', '^', '`', '\x3', '\x2', '\x2', '\x2', '_', ']', '\x3',
814  '\x2', '\x2', '\x2', '`', '\x61', '\a', '\x12', '\x2', '\x2', '\x61',
815  '\x63', '\x3', '\x2', '\x2', '\x2', '\x62', 'W', '\x3', '\x2', '\x2',
816  '\x2', '\x62', '\x63', '\x3', '\x2', '\x2', '\x2', '\x63', '\r', '\x3',
817  '\x2', '\x2', '\x2', '\x64', 'u', '\a', '\xE', '\x2', '\x2', '\x65', 'u',
818  '\a', '\xF', '\x2', '\x2', '\x66', 'u', '\x5', '\f', '\a', '\x2', 'g',
819  'p', '\a', '\a', '\x2', '\x2', 'h', 'm', '\x5', '\xE', '\b', '\x2', 'i',
820  'j', '\a', '\r', '\x2', '\x2', 'j', 'l', '\x5', '\xE', '\b', '\x2', 'k',
821  'i', '\x3', '\x2', '\x2', '\x2', 'l', 'o', '\x3', '\x2', '\x2', '\x2',
822  'm', 'k', '\x3', '\x2', '\x2', '\x2', 'm', 'n', '\x3', '\x2', '\x2', '\x2',
823  'n', 'q', '\x3', '\x2', '\x2', '\x2', 'o', 'm', '\x3', '\x2', '\x2', '\x2',
824  'p', 'h', '\x3', '\x2', '\x2', '\x2', 'p', 'q', '\x3', '\x2', '\x2', '\x2',
825  'q', 'r', '\x3', '\x2', '\x2', '\x2', 'r', 'u', '\a', '\b', '\x2', '\x2',
826  's', 'u', '\a', '\x10', '\x2', '\x2', 't', '\x64', '\x3', '\x2', '\x2',
827  '\x2', 't', '\x65', '\x3', '\x2', '\x2', '\x2', 't', '\x66', '\x3', '\x2',
828  '\x2', '\x2', 't', 'g', '\x3', '\x2', '\x2', '\x2', 't', 's', '\x3', '\x2',
829  '\x2', '\x2', 'u', '\xF', '\x3', '\x2', '\x2', '\x2', 'v', 'w', '\a',
830  '\x18', '\x2', '\x2', 'w', 'x', '\x5', '\b', '\x5', '\x2', 'x', '\x11',
831  '\x3', '\x2', '\x2', '\x2', '\x10', '\x17', '\x1F', '\'', '+', '\x30',
832  '\x38', 'I', 'L', 'S', ']', '\x62', 'm', 'p', 't',
833  };
834 
835  public static readonly ATN _ATN =
836  new ATNDeserializer().Deserialize(_serializedATN);
837 
838 
839 }
IDLVParserVisitor.VisitTerm
Result VisitTerm([NotNull] DLVParser.TermContext context)
Visit a parse tree produced by DLVParser.term.
IDLVParserVisitor
This interface defines a complete generic visitor for a parse tree produced by DLVParser.
Definition: DLVParserVisitor.cs:33
base
Definition: Callback.cs:1
IDLVParserVisitor.VisitCost
Result VisitCost([NotNull] DLVParser.CostContext context)
Visit a parse tree produced by DLVParser.cost.
IDLVParserVisitor.VisitOutput
Result VisitOutput([NotNull] DLVParser.OutputContext context)
Visit a parse tree produced by DLVParser.output.
IDLVParserVisitor.VisitGroundQuery
Result VisitGroundQuery([NotNull] DLVParser.GroundQueryContext context)
Visit a parse tree produced by the GroundQuery labeled alternative in DLVParser.answer_set.
IDLVParserVisitor.VisitModel
Result VisitModel([NotNull] DLVParser.ModelContext context)
Visit a parse tree produced by DLVParser.model.
IDLVParserVisitor.VisitWeightedModel
Result VisitWeightedModel([NotNull] DLVParser.WeightedModelContext context)
Visit a parse tree produced by the WeightedModel labeled alternative in DLVParser....
IDLVParserVisitor.VisitSimpleModel
Result VisitSimpleModel([NotNull] DLVParser.SimpleModelContext context)
Visit a parse tree produced by the SimpleModel labeled alternative in DLVParser.answer_set.
IDLVParserVisitor.VisitPredicate
Result VisitPredicate([NotNull] DLVParser.PredicateContext context)
Visit a parse tree produced by DLVParser.predicate.
IDLVParserVisitor.VisitWitness
Result VisitWitness([NotNull] DLVParser.WitnessContext context)
Visit a parse tree produced by DLVParser.witness.
IDLVParserVisitor.VisitNonGroundQuery
Result VisitNonGroundQuery([NotNull] DLVParser.NonGroundQueryContext context)
Visit a parse tree produced by the NonGroundQuery labeled alternative in DLVParser....
IDLVParserVisitor.VisitCost_level
Result VisitCost_level([NotNull] DLVParser.Cost_levelContext context)
Visit a parse tree produced by DLVParser.cost_level.