14 #pragma warning disable 0162
16 #pragma warning disable 0219
18 #pragma warning disable 1591
20 #pragma warning disable 419
25 using System.Diagnostics;
26 using System.Collections.Generic;
28 using Antlr4.Runtime.Atn;
29 using Antlr4.Runtime.Misc;
30 using Antlr4.Runtime.Tree;
31 using DFA = Antlr4.Runtime.Dfa.DFA;
33 [System.CodeDom.Compiler.GeneratedCode(
"ANTLR",
"4.7")]
34 [System.CLSCompliant(
false)]
35 public partial class ClingoParser : Parser {
36 protected static DFA[] decisionToDFA;
37 protected static PredictionContextCache sharedContextCache =
new PredictionContextCache();
39 START=1, ANY=2, COMMA=3, INTEGER_CONSTANT=4, NEW_LINE=5, IDENTIFIER=6,
40 STRING_CONSTANT=7, TERMS_BEGIN=8, TERMS_END=9, WHITE_SPACE=10;
42 RULE_answer_set = 0, RULE_model = 1, RULE_output = 2, RULE_predicate_atom = 3,
44 public static readonly
string[] ruleNames = {
45 "answer_set",
"model",
"output",
"predicate_atom",
"term"
48 private static readonly
string[] _LiteralNames = {
49 null,
null,
null,
"','",
null,
null,
null,
null,
"'('",
"')'"
51 private static readonly
string[] _SymbolicNames = {
52 null,
"START",
"ANY",
"COMMA",
"INTEGER_CONSTANT",
"NEW_LINE",
"IDENTIFIER",
53 "STRING_CONSTANT",
"TERMS_BEGIN",
"TERMS_END",
"WHITE_SPACE"
55 public static readonly IVocabulary DefaultVocabulary =
new Vocabulary(_LiteralNames, _SymbolicNames);
58 public override IVocabulary Vocabulary
62 return DefaultVocabulary;
66 public override string GrammarFileName {
get {
return "ClingoParser.g4"; } }
68 public override string[] RuleNames {
get {
return ruleNames; } }
70 public override string SerializedAtn {
get {
return new string(_serializedATN); } }
72 static ClingoParser() {
73 decisionToDFA =
new DFA[_ATN.NumberOfDecisions];
74 for (
int i = 0; i < _ATN.NumberOfDecisions; i++) {
75 decisionToDFA[i] =
new DFA(_ATN.GetDecisionState(i), i);
79 public ClingoParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }
81 public ClingoParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
82 :
base(input, output, errorOutput)
84 Interpreter =
new ParserATNSimulator(
this, _ATN, decisionToDFA, sharedContextCache);
86 public partial class Answer_setContext : ParserRuleContext {
87 public ITerminalNode START() {
return GetToken(ClingoParser.START, 0); }
88 public ModelContext model() {
89 return GetRuleContext<ModelContext>(0);
91 public Answer_setContext(ParserRuleContext parent,
int invokingState)
92 :
base(parent, invokingState)
95 public override int RuleIndex {
get {
return RULE_answer_set; } }
96 public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
99 else return visitor.VisitChildren(
this);
104 public Answer_setContext answer_set() {
105 Answer_setContext _localctx =
new Answer_setContext(Context, State);
106 EnterRule(_localctx, 0, RULE_answer_set);
108 EnterOuterAlt(_localctx, 1);
110 State = 10; Match(START);
114 catch (RecognitionException re) {
115 _localctx.exception = re;
116 ErrorHandler.ReportError(
this, re);
117 ErrorHandler.Recover(
this, re);
125 public partial class ModelContext : ParserRuleContext {
126 public ITerminalNode NEW_LINE() {
return GetToken(ClingoParser.NEW_LINE, 0); }
127 public Predicate_atomContext[] predicate_atom() {
128 return GetRuleContexts<Predicate_atomContext>();
130 public Predicate_atomContext predicate_atom(
int i) {
131 return GetRuleContext<Predicate_atomContext>(i);
133 public ModelContext(ParserRuleContext parent,
int invokingState)
134 :
base(parent, invokingState)
137 public override int RuleIndex {
get {
return RULE_model; } }
138 public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
140 if (typedVisitor !=
null)
return typedVisitor.
VisitModel(
this);
141 else return visitor.VisitChildren(
this);
146 public ModelContext model() {
147 ModelContext _localctx =
new ModelContext(Context, State);
148 EnterRule(_localctx, 2, RULE_model);
151 EnterOuterAlt(_localctx, 1);
154 ErrorHandler.Sync(
this);
155 _la = TokenStream.LA(1);
156 while (_la==IDENTIFIER) {
159 State = 13; predicate_atom();
163 ErrorHandler.Sync(
this);
164 _la = TokenStream.LA(1);
166 State = 19; Match(NEW_LINE);
169 catch (RecognitionException re) {
170 _localctx.exception = re;
171 ErrorHandler.ReportError(
this, re);
172 ErrorHandler.Recover(
this, re);
180 public partial class OutputContext : ParserRuleContext {
181 public Answer_setContext[] answer_set() {
182 return GetRuleContexts<Answer_setContext>();
184 public Answer_setContext answer_set(
int i) {
185 return GetRuleContext<Answer_setContext>(i);
187 public OutputContext(ParserRuleContext parent,
int invokingState)
188 :
base(parent, invokingState)
191 public override int RuleIndex {
get {
return RULE_output; } }
192 public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
194 if (typedVisitor !=
null)
return typedVisitor.
VisitOutput(
this);
195 else return visitor.VisitChildren(
this);
200 public OutputContext output() {
201 OutputContext _localctx =
new OutputContext(Context, State);
202 EnterRule(_localctx, 4, RULE_output);
205 EnterOuterAlt(_localctx, 1);
208 ErrorHandler.Sync(
this);
209 _la = TokenStream.LA(1);
213 State = 21; answer_set();
217 ErrorHandler.Sync(
this);
218 _la = TokenStream.LA(1);
222 catch (RecognitionException re) {
223 _localctx.exception = re;
224 ErrorHandler.ReportError(
this, re);
225 ErrorHandler.Recover(
this, re);
233 public partial class Predicate_atomContext : ParserRuleContext {
234 public ITerminalNode IDENTIFIER() {
return GetToken(ClingoParser.IDENTIFIER, 0); }
235 public ITerminalNode TERMS_BEGIN() {
return GetToken(ClingoParser.TERMS_BEGIN, 0); }
236 public TermContext[] term() {
237 return GetRuleContexts<TermContext>();
239 public TermContext term(
int i) {
240 return GetRuleContext<TermContext>(i);
242 public ITerminalNode TERMS_END() {
return GetToken(ClingoParser.TERMS_END, 0); }
243 public ITerminalNode[] COMMA() {
return GetTokens(ClingoParser.COMMA); }
244 public ITerminalNode COMMA(
int i) {
245 return GetToken(ClingoParser.COMMA, i);
247 public Predicate_atomContext(ParserRuleContext parent,
int invokingState)
248 :
base(parent, invokingState)
251 public override int RuleIndex {
get {
return RULE_predicate_atom; } }
252 public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
255 else return visitor.VisitChildren(
this);
260 public Predicate_atomContext predicate_atom() {
261 Predicate_atomContext _localctx =
new Predicate_atomContext(Context, State);
262 EnterRule(_localctx, 6, RULE_predicate_atom);
265 EnterOuterAlt(_localctx, 1);
267 State = 27; Match(IDENTIFIER);
269 ErrorHandler.Sync(
this);
270 _la = TokenStream.LA(1);
271 if (_la==TERMS_BEGIN) {
273 State = 28; Match(TERMS_BEGIN);
276 ErrorHandler.Sync(
this);
277 _la = TokenStream.LA(1);
281 State = 30; Match(COMMA);
286 ErrorHandler.Sync(
this);
287 _la = TokenStream.LA(1);
289 State = 37; Match(TERMS_END);
295 catch (RecognitionException re) {
296 _localctx.exception = re;
297 ErrorHandler.ReportError(
this, re);
298 ErrorHandler.Recover(
this, re);
306 public partial class TermContext : ParserRuleContext {
307 public ITerminalNode IDENTIFIER() {
return GetToken(ClingoParser.IDENTIFIER, 0); }
308 public ITerminalNode INTEGER_CONSTANT() {
return GetToken(ClingoParser.INTEGER_CONSTANT, 0); }
309 public Predicate_atomContext predicate_atom() {
310 return GetRuleContext<Predicate_atomContext>(0);
312 public ITerminalNode STRING_CONSTANT() {
return GetToken(ClingoParser.STRING_CONSTANT, 0); }
313 public TermContext(ParserRuleContext parent,
int invokingState)
314 :
base(parent, invokingState)
317 public override int RuleIndex {
get {
return RULE_term; } }
318 public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor) {
320 if (typedVisitor !=
null)
return typedVisitor.
VisitTerm(
this);
321 else return visitor.VisitChildren(
this);
326 public TermContext term() {
327 TermContext _localctx =
new TermContext(Context, State);
328 EnterRule(_localctx, 8, RULE_term);
331 ErrorHandler.Sync(
this);
332 switch ( Interpreter.AdaptivePredict(TokenStream,4,Context) ) {
334 EnterOuterAlt(_localctx, 1);
336 State = 41; Match(IDENTIFIER);
340 EnterOuterAlt(_localctx, 2);
342 State = 42; Match(INTEGER_CONSTANT);
346 EnterOuterAlt(_localctx, 3);
348 State = 43; predicate_atom();
352 EnterOuterAlt(_localctx, 4);
354 State = 44; Match(STRING_CONSTANT);
359 catch (RecognitionException re) {
360 _localctx.exception = re;
361 ErrorHandler.ReportError(
this, re);
362 ErrorHandler.Recover(
this, re);
370 private static char[] _serializedATN = {
371 '\x3',
'\x608B',
'\xA72A',
'\x8133',
'\xB9ED',
'\x417C',
'\x3BE7',
'\x7786',
372 '\x5964',
'\x3',
'\f',
'\x32',
'\x4',
'\x2',
'\t',
'\x2',
'\x4',
'\x3',
373 '\t',
'\x3',
'\x4',
'\x4',
'\t',
'\x4',
'\x4',
'\x5',
'\t',
'\x5',
'\x4',
374 '\x6',
'\t',
'\x6',
'\x3',
'\x2',
'\x3',
'\x2',
'\x3',
'\x2',
'\x3',
'\x3',
375 '\a',
'\x3',
'\x11',
'\n',
'\x3',
'\f',
'\x3',
'\xE',
'\x3',
'\x14',
'\v',
376 '\x3',
'\x3',
'\x3',
'\x3',
'\x3',
'\x3',
'\x4',
'\a',
'\x4',
'\x19',
377 '\n',
'\x4',
'\f',
'\x4',
'\xE',
'\x4',
'\x1C',
'\v',
'\x4',
'\x3',
'\x5',
378 '\x3',
'\x5',
'\x3',
'\x5',
'\x3',
'\x5',
'\x3',
'\x5',
'\a',
'\x5',
'#',
379 '\n',
'\x5',
'\f',
'\x5',
'\xE',
'\x5',
'&',
'\v',
'\x5',
'\x3',
'\x5',
380 '\x3',
'\x5',
'\x5',
'\x5',
'*',
'\n',
'\x5',
'\x3',
'\x6',
'\x3',
'\x6',
381 '\x3',
'\x6',
'\x3',
'\x6',
'\x5',
'\x6',
'\x30',
'\n',
'\x6',
'\x3',
382 '\x6',
'\x2',
'\x2',
'\a',
'\x2',
'\x4',
'\x6',
'\b',
'\n',
'\x2',
'\x2',
383 '\x2',
'\x33',
'\x2',
'\f',
'\x3',
'\x2',
'\x2',
'\x2',
'\x4',
'\x12',
384 '\x3',
'\x2',
'\x2',
'\x2',
'\x6',
'\x1A',
'\x3',
'\x2',
'\x2',
'\x2',
385 '\b',
'\x1D',
'\x3',
'\x2',
'\x2',
'\x2',
'\n',
'/',
'\x3',
'\x2',
'\x2',
386 '\x2',
'\f',
'\r',
'\a',
'\x3',
'\x2',
'\x2',
'\r',
'\xE',
'\x5',
'\x4',
387 '\x3',
'\x2',
'\xE',
'\x3',
'\x3',
'\x2',
'\x2',
'\x2',
'\xF',
'\x11',
388 '\x5',
'\b',
'\x5',
'\x2',
'\x10',
'\xF',
'\x3',
'\x2',
'\x2',
'\x2',
389 '\x11',
'\x14',
'\x3',
'\x2',
'\x2',
'\x2',
'\x12',
'\x10',
'\x3',
'\x2',
390 '\x2',
'\x2',
'\x12',
'\x13',
'\x3',
'\x2',
'\x2',
'\x2',
'\x13',
'\x15',
391 '\x3',
'\x2',
'\x2',
'\x2',
'\x14',
'\x12',
'\x3',
'\x2',
'\x2',
'\x2',
392 '\x15',
'\x16',
'\a',
'\a',
'\x2',
'\x2',
'\x16',
'\x5',
'\x3',
'\x2',
393 '\x2',
'\x2',
'\x17',
'\x19',
'\x5',
'\x2',
'\x2',
'\x2',
'\x18',
'\x17',
394 '\x3',
'\x2',
'\x2',
'\x2',
'\x19',
'\x1C',
'\x3',
'\x2',
'\x2',
'\x2',
395 '\x1A',
'\x18',
'\x3',
'\x2',
'\x2',
'\x2',
'\x1A',
'\x1B',
'\x3',
'\x2',
396 '\x2',
'\x2',
'\x1B',
'\a',
'\x3',
'\x2',
'\x2',
'\x2',
'\x1C',
'\x1A',
397 '\x3',
'\x2',
'\x2',
'\x2',
'\x1D',
')',
'\a',
'\b',
'\x2',
'\x2',
'\x1E',
398 '\x1F',
'\a',
'\n',
'\x2',
'\x2',
'\x1F',
'$',
'\x5',
'\n',
'\x6',
'\x2',
399 ' ',
'!',
'\a',
'\x5',
'\x2',
'\x2',
'!',
'#',
'\x5',
'\n',
'\x6',
'\x2',
400 '\"',
' ',
'\x3',
'\x2',
'\x2',
'\x2',
'#',
'&',
'\x3',
'\x2',
'\x2',
401 '\x2',
'$',
'\"',
'\x3',
'\x2',
'\x2',
'\x2',
'$',
'%',
'\x3',
'\x2',
402 '\x2',
'\x2',
'%',
'\'',
'\x3',
'\x2',
'\x2',
'\x2',
'&',
'$',
'\x3',
403 '\x2',
'\x2',
'\x2',
'\'',
'(',
'\a',
'\v',
'\x2',
'\x2',
'(',
'*',
'\x3',
404 '\x2',
'\x2',
'\x2',
')',
'\x1E',
'\x3',
'\x2',
'\x2',
'\x2',
')',
'*',
405 '\x3',
'\x2',
'\x2',
'\x2',
'*',
'\t',
'\x3',
'\x2',
'\x2',
'\x2',
'+',
406 '\x30',
'\a',
'\b',
'\x2',
'\x2',
',',
'\x30',
'\a',
'\x6',
'\x2',
'\x2',
407 '-',
'\x30',
'\x5',
'\b',
'\x5',
'\x2',
'.',
'\x30',
'\a',
'\t',
'\x2',
408 '\x2',
'/',
'+',
'\x3',
'\x2',
'\x2',
'\x2',
'/',
',',
'\x3',
'\x2',
'\x2',
409 '\x2',
'/',
'-',
'\x3',
'\x2',
'\x2',
'\x2',
'/',
'.',
'\x3',
'\x2',
'\x2',
410 '\x2',
'\x30',
'\v',
'\x3',
'\x2',
'\x2',
'\x2',
'\a',
'\x12',
'\x1A',
414 public static readonly ATN _ATN =
415 new ATNDeserializer().Deserialize(_serializedATN);