# Generated from jsgParser.g4 by ANTLR 4.9
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\'")
        buf.write("\u0143\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\3\2\5\2F\n\2\3\2\7\2I\n")
        buf.write("\2\f\2\16\2L\13\2\3\2\7\2O\n\2\f\2\16\2R\13\2\3\2\5\2")
        buf.write("U\n\2\3\2\3\2\3\3\3\3\3\3\5\3\\\n\3\3\3\3\3\3\4\3\4\6")
        buf.write("\4b\n\4\r\4\16\4c\3\5\3\5\7\5h\n\5\f\5\16\5k\13\5\3\5")
        buf.write("\3\5\3\6\3\6\3\6\3\6\5\6s\n\6\3\7\3\7\3\7\3\b\3\b\5\b")
        buf.write("z\n\b\3\b\3\b\3\b\5\b\177\n\b\3\b\3\b\3\b\5\b\u0084\n")
        buf.write("\b\3\b\3\b\5\b\u0088\n\b\3\t\3\t\6\t\u008c\n\t\r\t\16")
        buf.write("\t\u008d\3\t\3\t\7\t\u0092\n\t\f\t\16\t\u0095\13\t\3\t")
        buf.write("\3\t\5\t\u0099\n\t\5\t\u009b\n\t\3\n\7\n\u009e\n\n\f\n")
        buf.write("\16\n\u00a1\13\n\3\13\3\13\5\13\u00a5\n\13\3\f\3\f\3\r")
        buf.write("\3\r\3\r\3\r\5\r\u00ad\n\r\3\r\3\r\5\r\u00b1\n\r\3\r\3")
        buf.write("\r\6\r\u00b5\n\r\r\r\16\r\u00b6\3\r\3\r\3\r\3\r\5\r\u00bd")
        buf.write("\n\r\5\r\u00bf\n\r\3\16\3\16\3\17\3\17\3\17\3\20\3\20")
        buf.write("\3\20\3\20\7\20\u00ca\n\20\f\20\16\20\u00cd\13\20\3\20")
        buf.write("\5\20\u00d0\n\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3")
        buf.write("\22\3\22\3\22\3\22\3\22\7\22\u00de\n\22\f\22\16\22\u00e1")
        buf.write("\13\22\3\22\3\22\3\23\3\23\3\24\3\24\5\24\u00e9\n\24\3")
        buf.write("\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\5\25\u00f4")
        buf.write("\n\25\3\26\3\26\3\26\6\26\u00f9\n\26\r\26\16\26\u00fa")
        buf.write("\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\5\30\u0106")
        buf.write("\n\30\5\30\u0108\n\30\3\30\5\30\u010b\n\30\3\31\3\31\7")
        buf.write("\31\u010f\n\31\f\31\16\31\u0112\13\31\3\32\3\32\3\32\3")
        buf.write("\32\3\32\3\33\3\33\5\33\u011b\n\33\3\34\3\34\3\34\7\34")
        buf.write("\u0120\n\34\f\34\16\34\u0123\13\34\3\35\3\35\5\35\u0127")
        buf.write("\n\35\3\36\6\36\u012a\n\36\r\36\16\36\u012b\3\37\3\37")
        buf.write("\5\37\u0130\n\37\3\37\3\37\5\37\u0134\n\37\5\37\u0136")
        buf.write("\n\37\3 \3 \3 \3 \3!\3!\3!\5!\u013f\n!\3\"\3\"\3\"\2\2")
        buf.write("#\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62")
        buf.write("\64\668:<>@B\2\7\4\2\3\3\7\7\3\2\4\5\4\2\7\7\f\22\4\2")
        buf.write("\6\6\32\32\4\2\5\5$$\2\u0154\2E\3\2\2\2\4X\3\2\2\2\6_")
        buf.write("\3\2\2\2\be\3\2\2\2\nr\3\2\2\2\ft\3\2\2\2\16\u0087\3\2")
        buf.write("\2\2\20\u009a\3\2\2\2\22\u009f\3\2\2\2\24\u00a2\3\2\2")
        buf.write("\2\26\u00a6\3\2\2\2\30\u00be\3\2\2\2\32\u00c0\3\2\2\2")
        buf.write("\34\u00c2\3\2\2\2\36\u00c5\3\2\2\2 \u00d3\3\2\2\2\"\u00d8")
        buf.write("\3\2\2\2$\u00e4\3\2\2\2&\u00e8\3\2\2\2(\u00f3\3\2\2\2")
        buf.write("*\u00f5\3\2\2\2,\u00fc\3\2\2\2.\u010a\3\2\2\2\60\u010c")
        buf.write("\3\2\2\2\62\u0113\3\2\2\2\64\u0118\3\2\2\2\66\u011c\3")
        buf.write("\2\2\28\u0126\3\2\2\2:\u0129\3\2\2\2<\u0135\3\2\2\2>\u0137")
        buf.write("\3\2\2\2@\u013e\3\2\2\2B\u0140\3\2\2\2DF\5\4\3\2ED\3\2")
        buf.write("\2\2EF\3\2\2\2FJ\3\2\2\2GI\5\b\5\2HG\3\2\2\2IL\3\2\2\2")
        buf.write("JH\3\2\2\2JK\3\2\2\2KP\3\2\2\2LJ\3\2\2\2MO\5\n\6\2NM\3")
        buf.write("\2\2\2OR\3\2\2\2PN\3\2\2\2PQ\3\2\2\2QT\3\2\2\2RP\3\2\2")
        buf.write("\2SU\5\60\31\2TS\3\2\2\2TU\3\2\2\2UV\3\2\2\2VW\7\2\2\3")
        buf.write("W\3\3\2\2\2XY\7\t\2\2Y[\5\32\16\2Z\\\5\6\4\2[Z\3\2\2\2")
        buf.write("[\\\3\2\2\2\\]\3\2\2\2]^\7\25\2\2^\5\3\2\2\2_a\7\26\2")
        buf.write("\2`b\5,\27\2a`\3\2\2\2bc\3\2\2\2ca\3\2\2\2cd\3\2\2\2d")
        buf.write("\7\3\2\2\2ei\7\n\2\2fh\5\32\16\2gf\3\2\2\2hk\3\2\2\2i")
        buf.write("g\3\2\2\2ij\3\2\2\2jl\3\2\2\2ki\3\2\2\2lm\7\25\2\2m\t")
        buf.write("\3\2\2\2ns\5\f\7\2os\5\34\17\2ps\5 \21\2qs\5\"\22\2rn")
        buf.write("\3\2\2\2ro\3\2\2\2rp\3\2\2\2rq\3\2\2\2s\13\3\2\2\2tu\7")
        buf.write("\4\2\2uv\5\16\b\2v\r\3\2\2\2wy\7\27\2\2xz\5\20\t\2yx\3")
        buf.write("\2\2\2yz\3\2\2\2z{\3\2\2\2{\u0088\7\30\2\2|~\7\27\2\2")
        buf.write("}\177\t\2\2\2~}\3\2\2\2~\177\3\2\2\2\177\u0080\3\2\2\2")
        buf.write("\u0080\u0081\7\13\2\2\u0081\u0083\5&\24\2\u0082\u0084")
        buf.write("\5.\30\2\u0083\u0082\3\2\2\2\u0083\u0084\3\2\2\2\u0084")
        buf.write("\u0085\3\2\2\2\u0085\u0086\7\30\2\2\u0086\u0088\3\2\2")
        buf.write("\2\u0087w\3\2\2\2\u0087|\3\2\2\2\u0088\17\3\2\2\2\u0089")
        buf.write("\u009b\7\31\2\2\u008a\u008c\5\24\13\2\u008b\u008a\3\2")
        buf.write("\2\2\u008c\u008d\3\2\2\2\u008d\u008b\3\2\2\2\u008d\u008e")
        buf.write("\3\2\2\2\u008e\u0093\3\2\2\2\u008f\u0090\7\37\2\2\u0090")
        buf.write("\u0092\5\22\n\2\u0091\u008f\3\2\2\2\u0092\u0095\3\2\2")
        buf.write("\2\u0093\u0091\3\2\2\2\u0093\u0094\3\2\2\2\u0094\u0098")
        buf.write("\3\2\2\2\u0095\u0093\3\2\2\2\u0096\u0097\7\37\2\2\u0097")
        buf.write("\u0099\5\26\f\2\u0098\u0096\3\2\2\2\u0098\u0099\3\2\2")
        buf.write("\2\u0099\u009b\3\2\2\2\u009a\u0089\3\2\2\2\u009a\u008b")
        buf.write("\3\2\2\2\u009b\21\3\2\2\2\u009c\u009e\5\24\13\2\u009d")
        buf.write("\u009c\3\2\2\2\u009e\u00a1\3\2\2\2\u009f\u009d\3\2\2\2")
        buf.write("\u009f\u00a0\3\2\2\2\u00a0\23\3\2\2\2\u00a1\u009f\3\2")
        buf.write("\2\2\u00a2\u00a4\5\30\r\2\u00a3\u00a5\7\31\2\2\u00a4\u00a3")
        buf.write("\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\25\3\2\2\2\u00a6\u00a7")
        buf.write("\7\31\2\2\u00a7\27\3\2\2\2\u00a8\u00a9\5\32\16\2\u00a9")
        buf.write("\u00aa\7 \2\2\u00aa\u00ac\5&\24\2\u00ab\u00ad\5.\30\2")
        buf.write("\u00ac\u00ab\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00bf\3")
        buf.write("\2\2\2\u00ae\u00b0\5,\27\2\u00af\u00b1\5.\30\2\u00b0\u00af")
        buf.write("\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00bf\3\2\2\2\u00b2")
        buf.write("\u00b4\7\35\2\2\u00b3\u00b5\5\32\16\2\u00b4\u00b3\3\2")
        buf.write("\2\2\u00b5\u00b6\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b6\u00b7")
        buf.write("\3\2\2\2\u00b7\u00b8\3\2\2\2\u00b8\u00b9\7\36\2\2\u00b9")
        buf.write("\u00ba\7 \2\2\u00ba\u00bc\5&\24\2\u00bb\u00bd\5.\30\2")
        buf.write("\u00bc\u00bb\3\2\2\2\u00bc\u00bd\3\2\2\2\u00bd\u00bf\3")
        buf.write("\2\2\2\u00be\u00a8\3\2\2\2\u00be\u00ae\3\2\2\2\u00be\u00b2")
        buf.write("\3\2\2\2\u00bf\31\3\2\2\2\u00c0\u00c1\t\3\2\2\u00c1\33")
        buf.write("\3\2\2\2\u00c2\u00c3\7\4\2\2\u00c3\u00c4\5\36\20\2\u00c4")
        buf.write("\35\3\2\2\2\u00c5\u00c6\7\23\2\2\u00c6\u00cb\5&\24\2\u00c7")
        buf.write("\u00c8\7\37\2\2\u00c8\u00ca\5&\24\2\u00c9\u00c7\3\2\2")
        buf.write("\2\u00ca\u00cd\3\2\2\2\u00cb\u00c9\3\2\2\2\u00cb\u00cc")
        buf.write("\3\2\2\2\u00cc\u00cf\3\2\2\2\u00cd\u00cb\3\2\2\2\u00ce")
        buf.write("\u00d0\5.\30\2\u00cf\u00ce\3\2\2\2\u00cf\u00d0\3\2\2\2")
        buf.write("\u00d0\u00d1\3\2\2\2\u00d1\u00d2\7\24\2\2\u00d2\37\3\2")
        buf.write("\2\2\u00d3\u00d4\7\4\2\2\u00d4\u00d5\7!\2\2\u00d5\u00d6")
        buf.write("\5\20\t\2\u00d6\u00d7\7\25\2\2\u00d7!\3\2\2\2\u00d8\u00d9")
        buf.write("\7\4\2\2\u00d9\u00da\7!\2\2\u00da\u00df\5(\25\2\u00db")
        buf.write("\u00dc\7\37\2\2\u00dc\u00de\5(\25\2\u00dd\u00db\3\2\2")
        buf.write("\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2\u00df\u00e0")
        buf.write("\3\2\2\2\u00e0\u00e2\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2")
        buf.write("\u00e3\7\25\2\2\u00e3#\3\2\2\2\u00e4\u00e5\t\4\2\2\u00e5")
        buf.write("%\3\2\2\2\u00e6\u00e9\5,\27\2\u00e7\u00e9\5(\25\2\u00e8")
        buf.write("\u00e6\3\2\2\2\u00e8\u00e7\3\2\2\2\u00e9\'\3\2\2\2\u00ea")
        buf.write("\u00f4\7\3\2\2\u00eb\u00f4\7\5\2\2\u00ec\u00f4\5$\23\2")
        buf.write("\u00ed\u00f4\5\16\b\2\u00ee\u00f4\5\36\20\2\u00ef\u00f0")
        buf.write("\7\35\2\2\u00f0\u00f1\5*\26\2\u00f1\u00f2\7\36\2\2\u00f2")
        buf.write("\u00f4\3\2\2\2\u00f3\u00ea\3\2\2\2\u00f3\u00eb\3\2\2\2")
        buf.write("\u00f3\u00ec\3\2\2\2\u00f3\u00ed\3\2\2\2\u00f3\u00ee\3")
        buf.write("\2\2\2\u00f3\u00ef\3\2\2\2\u00f4)\3\2\2\2\u00f5\u00f8")
        buf.write("\5&\24\2\u00f6\u00f7\7\37\2\2\u00f7\u00f9\5&\24\2\u00f8")
        buf.write("\u00f6\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00f8\3\2\2\2")
        buf.write("\u00fa\u00fb\3\2\2\2\u00fb+\3\2\2\2\u00fc\u00fd\7\4\2")
        buf.write("\2\u00fd-\3\2\2\2\u00fe\u010b\7\33\2\2\u00ff\u010b\7\32")
        buf.write("\2\2\u0100\u010b\7\34\2\2\u0101\u0102\7\27\2\2\u0102\u0107")
        buf.write("\7\6\2\2\u0103\u0105\7\31\2\2\u0104\u0106\t\5\2\2\u0105")
        buf.write("\u0104\3\2\2\2\u0105\u0106\3\2\2\2\u0106\u0108\3\2\2\2")
        buf.write("\u0107\u0103\3\2\2\2\u0107\u0108\3\2\2\2\u0108\u0109\3")
        buf.write("\2\2\2\u0109\u010b\7\30\2\2\u010a\u00fe\3\2\2\2\u010a")
        buf.write("\u00ff\3\2\2\2\u010a\u0100\3\2\2\2\u010a\u0101\3\2\2\2")
        buf.write("\u010b/\3\2\2\2\u010c\u0110\7\b\2\2\u010d\u010f\5\62\32")
        buf.write("\2\u010e\u010d\3\2\2\2\u010f\u0112\3\2\2\2\u0110\u010e")
        buf.write("\3\2\2\2\u0110\u0111\3\2\2\2\u0111\61\3\2\2\2\u0112\u0110")
        buf.write("\3\2\2\2\u0113\u0114\7$\2\2\u0114\u0115\7 \2\2\u0115\u0116")
        buf.write("\5\64\33\2\u0116\u0117\7\25\2\2\u0117\63\3\2\2\2\u0118")
        buf.write("\u011a\5\66\34\2\u0119\u011b\5$\23\2\u011a\u0119\3\2\2")
        buf.write("\2\u011a\u011b\3\2\2\2\u011b\65\3\2\2\2\u011c\u0121\5")
        buf.write("8\35\2\u011d\u011e\7\37\2\2\u011e\u0120\58\35\2\u011f")
        buf.write("\u011d\3\2\2\2\u0120\u0123\3\2\2\2\u0121\u011f\3\2\2\2")
        buf.write("\u0121\u0122\3\2\2\2\u0122\67\3\2\2\2\u0123\u0121\3\2")
        buf.write("\2\2\u0124\u0127\5:\36\2\u0125\u0127\3\2\2\2\u0126\u0124")
        buf.write("\3\2\2\2\u0126\u0125\3\2\2\2\u01279\3\2\2\2\u0128\u012a")
        buf.write("\5<\37\2\u0129\u0128\3\2\2\2\u012a\u012b\3\2\2\2\u012b")
        buf.write("\u0129\3\2\2\2\u012b\u012c\3\2\2\2\u012c;\3\2\2\2\u012d")
        buf.write("\u012f\5@!\2\u012e\u0130\5.\30\2\u012f\u012e\3\2\2\2\u012f")
        buf.write("\u0130\3\2\2\2\u0130\u0136\3\2\2\2\u0131\u0133\5> \2\u0132")
        buf.write("\u0134\5.\30\2\u0133\u0132\3\2\2\2\u0133\u0134\3\2\2\2")
        buf.write("\u0134\u0136\3\2\2\2\u0135\u012d\3\2\2\2\u0135\u0131\3")
        buf.write("\2\2\2\u0136=\3\2\2\2\u0137\u0138\7\35\2\2\u0138\u0139")
        buf.write("\5\66\34\2\u0139\u013a\7\36\2\2\u013a?\3\2\2\2\u013b\u013f")
        buf.write("\5B\"\2\u013c\u013f\7%\2\2\u013d\u013f\7\7\2\2\u013e\u013b")
        buf.write("\3\2\2\2\u013e\u013c\3\2\2\2\u013e\u013d\3\2\2\2\u013f")
        buf.write("A\3\2\2\2\u0140\u0141\t\6\2\2\u0141C\3\2\2\2+EJPT[cir")
        buf.write("y~\u0083\u0087\u008d\u0093\u0098\u009a\u009f\u00a4\u00ac")
        buf.write("\u00b0\u00b6\u00bc\u00be\u00cb\u00cf\u00df\u00e8\u00f3")
        buf.write("\u00fa\u0105\u0107\u010a\u0110\u011a\u0121\u0126\u012b")
        buf.write("\u012f\u0133\u0135\u013e")
        return buf.getvalue()


class jsgParser ( Parser ):

    grammarFileName = "jsgParser.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'@terminals'", "'.TYPE'", 
                     "'.IGNORE'", "'->'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'['", "']'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'='" ]

    symbolicNames = [ "<INVALID>", "LEXER_ID_REF", "ID", "STRING", "INT", 
                      "ANY", "TERMINALS", "TYPE", "IGNORE", "MAPSTO", "JSON_STRING", 
                      "JSON_NUMBER", "JSON_INT", "JSON_BOOL", "JSON_NULL", 
                      "JSON_ARRAY", "JSON_OBJECT", "OBRACKET", "CBRACKET", 
                      "SEMI", "DASH", "OBRACE", "CBRACE", "COMMA", "STAR", 
                      "QMARK", "PLUS", "OPREN", "CPREN", "BAR", "COLON", 
                      "EQUALS", "PASS", "COMMENT", "LEXER_ID", "LEXER_CHAR_SET", 
                      "LEXER_PASS", "LEXER_COMMENT" ]

    RULE_doc = 0
    RULE_typeDirective = 1
    RULE_typeExceptions = 2
    RULE_ignoreDirective = 3
    RULE_grammarElt = 4
    RULE_objectDef = 5
    RULE_objectExpr = 6
    RULE_membersDef = 7
    RULE_altMemberDef = 8
    RULE_member = 9
    RULE_lastComma = 10
    RULE_pairDef = 11
    RULE_name = 12
    RULE_arrayDef = 13
    RULE_arrayExpr = 14
    RULE_objectMacro = 15
    RULE_valueTypeMacro = 16
    RULE_builtinValueType = 17
    RULE_valueType = 18
    RULE_nonRefValueType = 19
    RULE_typeAlternatives = 20
    RULE_idref = 21
    RULE_ebnfSuffix = 22
    RULE_lexerRules = 23
    RULE_lexerRuleSpec = 24
    RULE_lexerRuleBlock = 25
    RULE_lexerAltList = 26
    RULE_lexerAlt = 27
    RULE_lexerElements = 28
    RULE_lexerElement = 29
    RULE_lexerBlock = 30
    RULE_lexerAtom = 31
    RULE_lexerTerminal = 32

    ruleNames =  [ "doc", "typeDirective", "typeExceptions", "ignoreDirective", 
                   "grammarElt", "objectDef", "objectExpr", "membersDef", 
                   "altMemberDef", "member", "lastComma", "pairDef", "name", 
                   "arrayDef", "arrayExpr", "objectMacro", "valueTypeMacro", 
                   "builtinValueType", "valueType", "nonRefValueType", "typeAlternatives", 
                   "idref", "ebnfSuffix", "lexerRules", "lexerRuleSpec", 
                   "lexerRuleBlock", "lexerAltList", "lexerAlt", "lexerElements", 
                   "lexerElement", "lexerBlock", "lexerAtom", "lexerTerminal" ]

    EOF = Token.EOF
    LEXER_ID_REF=1
    ID=2
    STRING=3
    INT=4
    ANY=5
    TERMINALS=6
    TYPE=7
    IGNORE=8
    MAPSTO=9
    JSON_STRING=10
    JSON_NUMBER=11
    JSON_INT=12
    JSON_BOOL=13
    JSON_NULL=14
    JSON_ARRAY=15
    JSON_OBJECT=16
    OBRACKET=17
    CBRACKET=18
    SEMI=19
    DASH=20
    OBRACE=21
    CBRACE=22
    COMMA=23
    STAR=24
    QMARK=25
    PLUS=26
    OPREN=27
    CPREN=28
    BAR=29
    COLON=30
    EQUALS=31
    PASS=32
    COMMENT=33
    LEXER_ID=34
    LEXER_CHAR_SET=35
    LEXER_PASS=36
    LEXER_COMMENT=37

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.9")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class DocContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EOF(self):
            return self.getToken(jsgParser.EOF, 0)

        def typeDirective(self):
            return self.getTypedRuleContext(jsgParser.TypeDirectiveContext,0)


        def ignoreDirective(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.IgnoreDirectiveContext)
            else:
                return self.getTypedRuleContext(jsgParser.IgnoreDirectiveContext,i)


        def grammarElt(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.GrammarEltContext)
            else:
                return self.getTypedRuleContext(jsgParser.GrammarEltContext,i)


        def lexerRules(self):
            return self.getTypedRuleContext(jsgParser.LexerRulesContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_doc

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDoc" ):
                return visitor.visitDoc(self)
            else:
                return visitor.visitChildren(self)




    def doc(self):

        localctx = jsgParser.DocContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_doc)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 67
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.TYPE:
                self.state = 66
                self.typeDirective()


            self.state = 72
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.IGNORE:
                self.state = 69
                self.ignoreDirective()
                self.state = 74
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 78
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.ID:
                self.state = 75
                self.grammarElt()
                self.state = 80
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 82
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.TERMINALS:
                self.state = 81
                self.lexerRules()


            self.state = 84
            self.match(jsgParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeDirectiveContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def TYPE(self):
            return self.getToken(jsgParser.TYPE, 0)

        def name(self):
            return self.getTypedRuleContext(jsgParser.NameContext,0)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def typeExceptions(self):
            return self.getTypedRuleContext(jsgParser.TypeExceptionsContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_typeDirective

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeDirective" ):
                return visitor.visitTypeDirective(self)
            else:
                return visitor.visitChildren(self)




    def typeDirective(self):

        localctx = jsgParser.TypeDirectiveContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_typeDirective)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 86
            self.match(jsgParser.TYPE)
            self.state = 87
            self.name()
            self.state = 89
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.DASH:
                self.state = 88
                self.typeExceptions()


            self.state = 91
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeExceptionsContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def DASH(self):
            return self.getToken(jsgParser.DASH, 0)

        def idref(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.IdrefContext)
            else:
                return self.getTypedRuleContext(jsgParser.IdrefContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_typeExceptions

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeExceptions" ):
                return visitor.visitTypeExceptions(self)
            else:
                return visitor.visitChildren(self)




    def typeExceptions(self):

        localctx = jsgParser.TypeExceptionsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_typeExceptions)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 93
            self.match(jsgParser.DASH)
            self.state = 95 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 94
                self.idref()
                self.state = 97 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==jsgParser.ID):
                    break

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IgnoreDirectiveContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IGNORE(self):
            return self.getToken(jsgParser.IGNORE, 0)

        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.NameContext)
            else:
                return self.getTypedRuleContext(jsgParser.NameContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_ignoreDirective

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIgnoreDirective" ):
                return visitor.visitIgnoreDirective(self)
            else:
                return visitor.visitChildren(self)




    def ignoreDirective(self):

        localctx = jsgParser.IgnoreDirectiveContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_ignoreDirective)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 99
            self.match(jsgParser.IGNORE)
            self.state = 103
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.ID or _la==jsgParser.STRING:
                self.state = 100
                self.name()
                self.state = 105
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 106
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GrammarEltContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def objectDef(self):
            return self.getTypedRuleContext(jsgParser.ObjectDefContext,0)


        def arrayDef(self):
            return self.getTypedRuleContext(jsgParser.ArrayDefContext,0)


        def objectMacro(self):
            return self.getTypedRuleContext(jsgParser.ObjectMacroContext,0)


        def valueTypeMacro(self):
            return self.getTypedRuleContext(jsgParser.ValueTypeMacroContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_grammarElt

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGrammarElt" ):
                return visitor.visitGrammarElt(self)
            else:
                return visitor.visitChildren(self)




    def grammarElt(self):

        localctx = jsgParser.GrammarEltContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_grammarElt)
        try:
            self.state = 112
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 108
                self.objectDef()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 109
                self.arrayDef()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 110
                self.objectMacro()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 111
                self.valueTypeMacro()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ObjectDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def objectExpr(self):
            return self.getTypedRuleContext(jsgParser.ObjectExprContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_objectDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitObjectDef" ):
                return visitor.visitObjectDef(self)
            else:
                return visitor.visitChildren(self)




    def objectDef(self):

        localctx = jsgParser.ObjectDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_objectDef)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(jsgParser.ID)
            self.state = 115
            self.objectExpr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ObjectExprContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OBRACE(self):
            return self.getToken(jsgParser.OBRACE, 0)

        def CBRACE(self):
            return self.getToken(jsgParser.CBRACE, 0)

        def membersDef(self):
            return self.getTypedRuleContext(jsgParser.MembersDefContext,0)


        def MAPSTO(self):
            return self.getToken(jsgParser.MAPSTO, 0)

        def valueType(self):
            return self.getTypedRuleContext(jsgParser.ValueTypeContext,0)


        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def LEXER_ID_REF(self):
            return self.getToken(jsgParser.LEXER_ID_REF, 0)

        def ANY(self):
            return self.getToken(jsgParser.ANY, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_objectExpr

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitObjectExpr" ):
                return visitor.visitObjectExpr(self)
            else:
                return visitor.visitChildren(self)




    def objectExpr(self):

        localctx = jsgParser.ObjectExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_objectExpr)
        self._la = 0 # Token type
        try:
            self.state = 133
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 117
                self.match(jsgParser.OBRACE)
                self.state = 119
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ID) | (1 << jsgParser.STRING) | (1 << jsgParser.COMMA) | (1 << jsgParser.OPREN))) != 0):
                    self.state = 118
                    self.membersDef()


                self.state = 121
                self.match(jsgParser.CBRACE)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 122
                self.match(jsgParser.OBRACE)
                self.state = 124
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==jsgParser.LEXER_ID_REF or _la==jsgParser.ANY:
                    self.state = 123
                    _la = self._input.LA(1)
                    if not(_la==jsgParser.LEXER_ID_REF or _la==jsgParser.ANY):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()


                self.state = 126
                self.match(jsgParser.MAPSTO)
                self.state = 127
                self.valueType()
                self.state = 129
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 128
                    self.ebnfSuffix()


                self.state = 131
                self.match(jsgParser.CBRACE)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MembersDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def member(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.MemberContext)
            else:
                return self.getTypedRuleContext(jsgParser.MemberContext,i)


        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def altMemberDef(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.AltMemberDefContext)
            else:
                return self.getTypedRuleContext(jsgParser.AltMemberDefContext,i)


        def lastComma(self):
            return self.getTypedRuleContext(jsgParser.LastCommaContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_membersDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMembersDef" ):
                return visitor.visitMembersDef(self)
            else:
                return visitor.visitChildren(self)




    def membersDef(self):

        localctx = jsgParser.MembersDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_membersDef)
        self._la = 0 # Token type
        try:
            self.state = 152
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.COMMA]:
                self.enterOuterAlt(localctx, 1)
                self.state = 135
                self.match(jsgParser.COMMA)
                pass
            elif token in [jsgParser.ID, jsgParser.STRING, jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 137 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 136
                    self.member()
                    self.state = 139 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ID) | (1 << jsgParser.STRING) | (1 << jsgParser.OPREN))) != 0)):
                        break

                self.state = 145
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,13,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 141
                        self.match(jsgParser.BAR)
                        self.state = 142
                        self.altMemberDef() 
                    self.state = 147
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,13,self._ctx)

                self.state = 150
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==jsgParser.BAR:
                    self.state = 148
                    self.match(jsgParser.BAR)
                    self.state = 149
                    self.lastComma()


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AltMemberDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def member(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.MemberContext)
            else:
                return self.getTypedRuleContext(jsgParser.MemberContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_altMemberDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAltMemberDef" ):
                return visitor.visitAltMemberDef(self)
            else:
                return visitor.visitChildren(self)




    def altMemberDef(self):

        localctx = jsgParser.AltMemberDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_altMemberDef)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ID) | (1 << jsgParser.STRING) | (1 << jsgParser.OPREN))) != 0):
                self.state = 154
                self.member()
                self.state = 159
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MemberContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def pairDef(self):
            return self.getTypedRuleContext(jsgParser.PairDefContext,0)


        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_member

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMember" ):
                return visitor.visitMember(self)
            else:
                return visitor.visitChildren(self)




    def member(self):

        localctx = jsgParser.MemberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_member)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 160
            self.pairDef()
            self.state = 162
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.COMMA:
                self.state = 161
                self.match(jsgParser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LastCommaContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lastComma

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLastComma" ):
                return visitor.visitLastComma(self)
            else:
                return visitor.visitChildren(self)




    def lastComma(self):

        localctx = jsgParser.LastCommaContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_lastComma)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 164
            self.match(jsgParser.COMMA)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PairDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.NameContext)
            else:
                return self.getTypedRuleContext(jsgParser.NameContext,i)


        def COLON(self):
            return self.getToken(jsgParser.COLON, 0)

        def valueType(self):
            return self.getTypedRuleContext(jsgParser.ValueTypeContext,0)


        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def idref(self):
            return self.getTypedRuleContext(jsgParser.IdrefContext,0)


        def OPREN(self):
            return self.getToken(jsgParser.OPREN, 0)

        def CPREN(self):
            return self.getToken(jsgParser.CPREN, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_pairDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPairDef" ):
                return visitor.visitPairDef(self)
            else:
                return visitor.visitChildren(self)




    def pairDef(self):

        localctx = jsgParser.PairDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_pairDef)
        self._la = 0 # Token type
        try:
            self.state = 188
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,22,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 166
                self.name()
                self.state = 167
                self.match(jsgParser.COLON)
                self.state = 168
                self.valueType()
                self.state = 170
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 169
                    self.ebnfSuffix()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 172
                self.idref()
                self.state = 174
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 173
                    self.ebnfSuffix()


                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 176
                self.match(jsgParser.OPREN)
                self.state = 178 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 177
                    self.name()
                    self.state = 180 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==jsgParser.ID or _la==jsgParser.STRING):
                        break

                self.state = 182
                self.match(jsgParser.CPREN)
                self.state = 183
                self.match(jsgParser.COLON)
                self.state = 184
                self.valueType()
                self.state = 186
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 185
                    self.ebnfSuffix()


                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NameContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def STRING(self):
            return self.getToken(jsgParser.STRING, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_name

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitName" ):
                return visitor.visitName(self)
            else:
                return visitor.visitChildren(self)




    def name(self):

        localctx = jsgParser.NameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_name)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 190
            _la = self._input.LA(1)
            if not(_la==jsgParser.ID or _la==jsgParser.STRING):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def arrayExpr(self):
            return self.getTypedRuleContext(jsgParser.ArrayExprContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_arrayDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayDef" ):
                return visitor.visitArrayDef(self)
            else:
                return visitor.visitChildren(self)




    def arrayDef(self):

        localctx = jsgParser.ArrayDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_arrayDef)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 192
            self.match(jsgParser.ID)
            self.state = 193
            self.arrayExpr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayExprContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OBRACKET(self):
            return self.getToken(jsgParser.OBRACKET, 0)

        def valueType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.ValueTypeContext)
            else:
                return self.getTypedRuleContext(jsgParser.ValueTypeContext,i)


        def CBRACKET(self):
            return self.getToken(jsgParser.CBRACKET, 0)

        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_arrayExpr

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayExpr" ):
                return visitor.visitArrayExpr(self)
            else:
                return visitor.visitChildren(self)




    def arrayExpr(self):

        localctx = jsgParser.ArrayExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_arrayExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.match(jsgParser.OBRACKET)
            self.state = 196
            self.valueType()
            self.state = 201
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.BAR:
                self.state = 197
                self.match(jsgParser.BAR)
                self.state = 198
                self.valueType()
                self.state = 203
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 205
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                self.state = 204
                self.ebnfSuffix()


            self.state = 207
            self.match(jsgParser.CBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ObjectMacroContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def EQUALS(self):
            return self.getToken(jsgParser.EQUALS, 0)

        def membersDef(self):
            return self.getTypedRuleContext(jsgParser.MembersDefContext,0)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_objectMacro

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitObjectMacro" ):
                return visitor.visitObjectMacro(self)
            else:
                return visitor.visitChildren(self)




    def objectMacro(self):

        localctx = jsgParser.ObjectMacroContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_objectMacro)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(jsgParser.ID)
            self.state = 210
            self.match(jsgParser.EQUALS)
            self.state = 211
            self.membersDef()
            self.state = 212
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueTypeMacroContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def EQUALS(self):
            return self.getToken(jsgParser.EQUALS, 0)

        def nonRefValueType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.NonRefValueTypeContext)
            else:
                return self.getTypedRuleContext(jsgParser.NonRefValueTypeContext,i)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def getRuleIndex(self):
            return jsgParser.RULE_valueTypeMacro

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitValueTypeMacro" ):
                return visitor.visitValueTypeMacro(self)
            else:
                return visitor.visitChildren(self)




    def valueTypeMacro(self):

        localctx = jsgParser.ValueTypeMacroContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_valueTypeMacro)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 214
            self.match(jsgParser.ID)
            self.state = 215
            self.match(jsgParser.EQUALS)
            self.state = 216
            self.nonRefValueType()
            self.state = 221
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.BAR:
                self.state = 217
                self.match(jsgParser.BAR)
                self.state = 218
                self.nonRefValueType()
                self.state = 223
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 224
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BuiltinValueTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def JSON_STRING(self):
            return self.getToken(jsgParser.JSON_STRING, 0)

        def JSON_NUMBER(self):
            return self.getToken(jsgParser.JSON_NUMBER, 0)

        def JSON_INT(self):
            return self.getToken(jsgParser.JSON_INT, 0)

        def JSON_BOOL(self):
            return self.getToken(jsgParser.JSON_BOOL, 0)

        def JSON_NULL(self):
            return self.getToken(jsgParser.JSON_NULL, 0)

        def JSON_ARRAY(self):
            return self.getToken(jsgParser.JSON_ARRAY, 0)

        def JSON_OBJECT(self):
            return self.getToken(jsgParser.JSON_OBJECT, 0)

        def ANY(self):
            return self.getToken(jsgParser.ANY, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_builtinValueType

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBuiltinValueType" ):
                return visitor.visitBuiltinValueType(self)
            else:
                return visitor.visitChildren(self)




    def builtinValueType(self):

        localctx = jsgParser.BuiltinValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_builtinValueType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 226
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ANY) | (1 << jsgParser.JSON_STRING) | (1 << jsgParser.JSON_NUMBER) | (1 << jsgParser.JSON_INT) | (1 << jsgParser.JSON_BOOL) | (1 << jsgParser.JSON_NULL) | (1 << jsgParser.JSON_ARRAY) | (1 << jsgParser.JSON_OBJECT))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def idref(self):
            return self.getTypedRuleContext(jsgParser.IdrefContext,0)


        def nonRefValueType(self):
            return self.getTypedRuleContext(jsgParser.NonRefValueTypeContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_valueType

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitValueType" ):
                return visitor.visitValueType(self)
            else:
                return visitor.visitChildren(self)




    def valueType(self):

        localctx = jsgParser.ValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_valueType)
        try:
            self.state = 230
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.ID]:
                self.enterOuterAlt(localctx, 1)
                self.state = 228
                self.idref()
                pass
            elif token in [jsgParser.LEXER_ID_REF, jsgParser.STRING, jsgParser.ANY, jsgParser.JSON_STRING, jsgParser.JSON_NUMBER, jsgParser.JSON_INT, jsgParser.JSON_BOOL, jsgParser.JSON_NULL, jsgParser.JSON_ARRAY, jsgParser.JSON_OBJECT, jsgParser.OBRACKET, jsgParser.OBRACE, jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 229
                self.nonRefValueType()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NonRefValueTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LEXER_ID_REF(self):
            return self.getToken(jsgParser.LEXER_ID_REF, 0)

        def STRING(self):
            return self.getToken(jsgParser.STRING, 0)

        def builtinValueType(self):
            return self.getTypedRuleContext(jsgParser.BuiltinValueTypeContext,0)


        def objectExpr(self):
            return self.getTypedRuleContext(jsgParser.ObjectExprContext,0)


        def arrayExpr(self):
            return self.getTypedRuleContext(jsgParser.ArrayExprContext,0)


        def OPREN(self):
            return self.getToken(jsgParser.OPREN, 0)

        def typeAlternatives(self):
            return self.getTypedRuleContext(jsgParser.TypeAlternativesContext,0)


        def CPREN(self):
            return self.getToken(jsgParser.CPREN, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_nonRefValueType

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitNonRefValueType" ):
                return visitor.visitNonRefValueType(self)
            else:
                return visitor.visitChildren(self)




    def nonRefValueType(self):

        localctx = jsgParser.NonRefValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_nonRefValueType)
        try:
            self.state = 241
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.LEXER_ID_REF]:
                self.enterOuterAlt(localctx, 1)
                self.state = 232
                self.match(jsgParser.LEXER_ID_REF)
                pass
            elif token in [jsgParser.STRING]:
                self.enterOuterAlt(localctx, 2)
                self.state = 233
                self.match(jsgParser.STRING)
                pass
            elif token in [jsgParser.ANY, jsgParser.JSON_STRING, jsgParser.JSON_NUMBER, jsgParser.JSON_INT, jsgParser.JSON_BOOL, jsgParser.JSON_NULL, jsgParser.JSON_ARRAY, jsgParser.JSON_OBJECT]:
                self.enterOuterAlt(localctx, 3)
                self.state = 234
                self.builtinValueType()
                pass
            elif token in [jsgParser.OBRACE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 235
                self.objectExpr()
                pass
            elif token in [jsgParser.OBRACKET]:
                self.enterOuterAlt(localctx, 5)
                self.state = 236
                self.arrayExpr()
                pass
            elif token in [jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 6)
                self.state = 237
                self.match(jsgParser.OPREN)
                self.state = 238
                self.typeAlternatives()
                self.state = 239
                self.match(jsgParser.CPREN)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeAlternativesContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def valueType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.ValueTypeContext)
            else:
                return self.getTypedRuleContext(jsgParser.ValueTypeContext,i)


        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def getRuleIndex(self):
            return jsgParser.RULE_typeAlternatives

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeAlternatives" ):
                return visitor.visitTypeAlternatives(self)
            else:
                return visitor.visitChildren(self)




    def typeAlternatives(self):

        localctx = jsgParser.TypeAlternativesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_typeAlternatives)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 243
            self.valueType()
            self.state = 246 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 244
                self.match(jsgParser.BAR)
                self.state = 245
                self.valueType()
                self.state = 248 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==jsgParser.BAR):
                    break

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IdrefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_idref

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdref" ):
                return visitor.visitIdref(self)
            else:
                return visitor.visitChildren(self)




    def idref(self):

        localctx = jsgParser.IdrefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_idref)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 250
            self.match(jsgParser.ID)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EbnfSuffixContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def QMARK(self):
            return self.getToken(jsgParser.QMARK, 0)

        def STAR(self):
            return self.getToken(jsgParser.STAR, 0)

        def PLUS(self):
            return self.getToken(jsgParser.PLUS, 0)

        def OBRACE(self):
            return self.getToken(jsgParser.OBRACE, 0)

        def INT(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.INT)
            else:
                return self.getToken(jsgParser.INT, i)

        def CBRACE(self):
            return self.getToken(jsgParser.CBRACE, 0)

        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_ebnfSuffix

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEbnfSuffix" ):
                return visitor.visitEbnfSuffix(self)
            else:
                return visitor.visitChildren(self)




    def ebnfSuffix(self):

        localctx = jsgParser.EbnfSuffixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_ebnfSuffix)
        self._la = 0 # Token type
        try:
            self.state = 264
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.QMARK]:
                self.enterOuterAlt(localctx, 1)
                self.state = 252
                self.match(jsgParser.QMARK)
                pass
            elif token in [jsgParser.STAR]:
                self.enterOuterAlt(localctx, 2)
                self.state = 253
                self.match(jsgParser.STAR)
                pass
            elif token in [jsgParser.PLUS]:
                self.enterOuterAlt(localctx, 3)
                self.state = 254
                self.match(jsgParser.PLUS)
                pass
            elif token in [jsgParser.OBRACE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 255
                self.match(jsgParser.OBRACE)
                self.state = 256
                self.match(jsgParser.INT)
                self.state = 261
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==jsgParser.COMMA:
                    self.state = 257
                    self.match(jsgParser.COMMA)
                    self.state = 259
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==jsgParser.INT or _la==jsgParser.STAR:
                        self.state = 258
                        _la = self._input.LA(1)
                        if not(_la==jsgParser.INT or _la==jsgParser.STAR):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()




                self.state = 263
                self.match(jsgParser.CBRACE)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerRulesContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def TERMINALS(self):
            return self.getToken(jsgParser.TERMINALS, 0)

        def lexerRuleSpec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.LexerRuleSpecContext)
            else:
                return self.getTypedRuleContext(jsgParser.LexerRuleSpecContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerRules

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerRules" ):
                return visitor.visitLexerRules(self)
            else:
                return visitor.visitChildren(self)




    def lexerRules(self):

        localctx = jsgParser.LexerRulesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_lexerRules)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 266
            self.match(jsgParser.TERMINALS)
            self.state = 270
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.LEXER_ID:
                self.state = 267
                self.lexerRuleSpec()
                self.state = 272
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerRuleSpecContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LEXER_ID(self):
            return self.getToken(jsgParser.LEXER_ID, 0)

        def COLON(self):
            return self.getToken(jsgParser.COLON, 0)

        def lexerRuleBlock(self):
            return self.getTypedRuleContext(jsgParser.LexerRuleBlockContext,0)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerRuleSpec

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerRuleSpec" ):
                return visitor.visitLexerRuleSpec(self)
            else:
                return visitor.visitChildren(self)




    def lexerRuleSpec(self):

        localctx = jsgParser.LexerRuleSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_lexerRuleSpec)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 273
            self.match(jsgParser.LEXER_ID)
            self.state = 274
            self.match(jsgParser.COLON)
            self.state = 275
            self.lexerRuleBlock()
            self.state = 276
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerRuleBlockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerAltList(self):
            return self.getTypedRuleContext(jsgParser.LexerAltListContext,0)


        def builtinValueType(self):
            return self.getTypedRuleContext(jsgParser.BuiltinValueTypeContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerRuleBlock

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerRuleBlock" ):
                return visitor.visitLexerRuleBlock(self)
            else:
                return visitor.visitChildren(self)




    def lexerRuleBlock(self):

        localctx = jsgParser.LexerRuleBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_lexerRuleBlock)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 278
            self.lexerAltList()
            self.state = 280
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ANY) | (1 << jsgParser.JSON_STRING) | (1 << jsgParser.JSON_NUMBER) | (1 << jsgParser.JSON_INT) | (1 << jsgParser.JSON_BOOL) | (1 << jsgParser.JSON_NULL) | (1 << jsgParser.JSON_ARRAY) | (1 << jsgParser.JSON_OBJECT))) != 0):
                self.state = 279
                self.builtinValueType()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerAltListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerAlt(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.LexerAltContext)
            else:
                return self.getTypedRuleContext(jsgParser.LexerAltContext,i)


        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerAltList

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerAltList" ):
                return visitor.visitLexerAltList(self)
            else:
                return visitor.visitChildren(self)




    def lexerAltList(self):

        localctx = jsgParser.LexerAltListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_lexerAltList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 282
            self.lexerAlt()
            self.state = 287
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.BAR:
                self.state = 283
                self.match(jsgParser.BAR)
                self.state = 284
                self.lexerAlt()
                self.state = 289
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerAltContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerElements(self):
            return self.getTypedRuleContext(jsgParser.LexerElementsContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerAlt

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerAlt" ):
                return visitor.visitLexerAlt(self)
            else:
                return visitor.visitChildren(self)




    def lexerAlt(self):

        localctx = jsgParser.LexerAltContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_lexerAlt)
        try:
            self.state = 292
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,35,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 290
                self.lexerElements()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)

                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerElementsContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerElement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.LexerElementContext)
            else:
                return self.getTypedRuleContext(jsgParser.LexerElementContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerElements

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerElements" ):
                return visitor.visitLexerElements(self)
            else:
                return visitor.visitChildren(self)




    def lexerElements(self):

        localctx = jsgParser.LexerElementsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_lexerElements)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 295 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 294
                    self.lexerElement()

                else:
                    raise NoViableAltException(self)
                self.state = 297 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,36,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerElementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerAtom(self):
            return self.getTypedRuleContext(jsgParser.LexerAtomContext,0)


        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def lexerBlock(self):
            return self.getTypedRuleContext(jsgParser.LexerBlockContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerElement

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerElement" ):
                return visitor.visitLexerElement(self)
            else:
                return visitor.visitChildren(self)




    def lexerElement(self):

        localctx = jsgParser.LexerElementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_lexerElement)
        self._la = 0 # Token type
        try:
            self.state = 307
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.STRING, jsgParser.ANY, jsgParser.LEXER_ID, jsgParser.LEXER_CHAR_SET]:
                self.enterOuterAlt(localctx, 1)
                self.state = 299
                self.lexerAtom()
                self.state = 301
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 300
                    self.ebnfSuffix()


                pass
            elif token in [jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 303
                self.lexerBlock()
                self.state = 305
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 304
                    self.ebnfSuffix()


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerBlockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OPREN(self):
            return self.getToken(jsgParser.OPREN, 0)

        def lexerAltList(self):
            return self.getTypedRuleContext(jsgParser.LexerAltListContext,0)


        def CPREN(self):
            return self.getToken(jsgParser.CPREN, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerBlock

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerBlock" ):
                return visitor.visitLexerBlock(self)
            else:
                return visitor.visitChildren(self)




    def lexerBlock(self):

        localctx = jsgParser.LexerBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_lexerBlock)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 309
            self.match(jsgParser.OPREN)
            self.state = 310
            self.lexerAltList()
            self.state = 311
            self.match(jsgParser.CPREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerAtomContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerTerminal(self):
            return self.getTypedRuleContext(jsgParser.LexerTerminalContext,0)


        def LEXER_CHAR_SET(self):
            return self.getToken(jsgParser.LEXER_CHAR_SET, 0)

        def ANY(self):
            return self.getToken(jsgParser.ANY, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerAtom

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerAtom" ):
                return visitor.visitLexerAtom(self)
            else:
                return visitor.visitChildren(self)




    def lexerAtom(self):

        localctx = jsgParser.LexerAtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_lexerAtom)
        try:
            self.state = 316
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.STRING, jsgParser.LEXER_ID]:
                self.enterOuterAlt(localctx, 1)
                self.state = 313
                self.lexerTerminal()
                pass
            elif token in [jsgParser.LEXER_CHAR_SET]:
                self.enterOuterAlt(localctx, 2)
                self.state = 314
                self.match(jsgParser.LEXER_CHAR_SET)
                pass
            elif token in [jsgParser.ANY]:
                self.enterOuterAlt(localctx, 3)
                self.state = 315
                self.match(jsgParser.ANY)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerTerminalContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LEXER_ID(self):
            return self.getToken(jsgParser.LEXER_ID, 0)

        def STRING(self):
            return self.getToken(jsgParser.STRING, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerTerminal

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerTerminal" ):
                return visitor.visitLexerTerminal(self)
            else:
                return visitor.visitChildren(self)




    def lexerTerminal(self):

        localctx = jsgParser.LexerTerminalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_lexerTerminal)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 318
            _la = self._input.LA(1)
            if not(_la==jsgParser.STRING or _la==jsgParser.LEXER_ID):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx






# Generated from jsgParser.g4 by ANTLR 4.9
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO


def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\'")
        buf.write("\u0143\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
        buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
        buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\3\2\5\2F\n\2\3\2\7\2I\n")
        buf.write("\2\f\2\16\2L\13\2\3\2\7\2O\n\2\f\2\16\2R\13\2\3\2\5\2")
        buf.write("U\n\2\3\2\3\2\3\3\3\3\3\3\5\3\\\n\3\3\3\3\3\3\4\3\4\6")
        buf.write("\4b\n\4\r\4\16\4c\3\5\3\5\7\5h\n\5\f\5\16\5k\13\5\3\5")
        buf.write("\3\5\3\6\3\6\3\6\3\6\5\6s\n\6\3\7\3\7\3\7\3\b\3\b\5\b")
        buf.write("z\n\b\3\b\3\b\3\b\5\b\177\n\b\3\b\3\b\3\b\5\b\u0084\n")
        buf.write("\b\3\b\3\b\5\b\u0088\n\b\3\t\3\t\6\t\u008c\n\t\r\t\16")
        buf.write("\t\u008d\3\t\3\t\7\t\u0092\n\t\f\t\16\t\u0095\13\t\3\t")
        buf.write("\3\t\5\t\u0099\n\t\5\t\u009b\n\t\3\n\7\n\u009e\n\n\f\n")
        buf.write("\16\n\u00a1\13\n\3\13\3\13\5\13\u00a5\n\13\3\f\3\f\3\r")
        buf.write("\3\r\3\r\3\r\5\r\u00ad\n\r\3\r\3\r\5\r\u00b1\n\r\3\r\3")
        buf.write("\r\6\r\u00b5\n\r\r\r\16\r\u00b6\3\r\3\r\3\r\3\r\5\r\u00bd")
        buf.write("\n\r\5\r\u00bf\n\r\3\16\3\16\3\17\3\17\3\17\3\20\3\20")
        buf.write("\3\20\3\20\7\20\u00ca\n\20\f\20\16\20\u00cd\13\20\3\20")
        buf.write("\5\20\u00d0\n\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3")
        buf.write("\22\3\22\3\22\3\22\3\22\7\22\u00de\n\22\f\22\16\22\u00e1")
        buf.write("\13\22\3\22\3\22\3\23\3\23\3\24\3\24\5\24\u00e9\n\24\3")
        buf.write("\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\5\25\u00f4")
        buf.write("\n\25\3\26\3\26\3\26\6\26\u00f9\n\26\r\26\16\26\u00fa")
        buf.write("\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\5\30\u0106")
        buf.write("\n\30\5\30\u0108\n\30\3\30\5\30\u010b\n\30\3\31\3\31\7")
        buf.write("\31\u010f\n\31\f\31\16\31\u0112\13\31\3\32\3\32\3\32\3")
        buf.write("\32\3\32\3\33\3\33\5\33\u011b\n\33\3\34\3\34\3\34\7\34")
        buf.write("\u0120\n\34\f\34\16\34\u0123\13\34\3\35\3\35\5\35\u0127")
        buf.write("\n\35\3\36\6\36\u012a\n\36\r\36\16\36\u012b\3\37\3\37")
        buf.write("\5\37\u0130\n\37\3\37\3\37\5\37\u0134\n\37\5\37\u0136")
        buf.write("\n\37\3 \3 \3 \3 \3!\3!\3!\5!\u013f\n!\3\"\3\"\3\"\2\2")
        buf.write("#\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62")
        buf.write("\64\668:<>@B\2\7\4\2\3\3\7\7\3\2\4\5\4\2\7\7\f\22\4\2")
        buf.write("\6\6\32\32\4\2\5\5$$\2\u0154\2E\3\2\2\2\4X\3\2\2\2\6_")
        buf.write("\3\2\2\2\be\3\2\2\2\nr\3\2\2\2\ft\3\2\2\2\16\u0087\3\2")
        buf.write("\2\2\20\u009a\3\2\2\2\22\u009f\3\2\2\2\24\u00a2\3\2\2")
        buf.write("\2\26\u00a6\3\2\2\2\30\u00be\3\2\2\2\32\u00c0\3\2\2\2")
        buf.write("\34\u00c2\3\2\2\2\36\u00c5\3\2\2\2 \u00d3\3\2\2\2\"\u00d8")
        buf.write("\3\2\2\2$\u00e4\3\2\2\2&\u00e8\3\2\2\2(\u00f3\3\2\2\2")
        buf.write("*\u00f5\3\2\2\2,\u00fc\3\2\2\2.\u010a\3\2\2\2\60\u010c")
        buf.write("\3\2\2\2\62\u0113\3\2\2\2\64\u0118\3\2\2\2\66\u011c\3")
        buf.write("\2\2\28\u0126\3\2\2\2:\u0129\3\2\2\2<\u0135\3\2\2\2>\u0137")
        buf.write("\3\2\2\2@\u013e\3\2\2\2B\u0140\3\2\2\2DF\5\4\3\2ED\3\2")
        buf.write("\2\2EF\3\2\2\2FJ\3\2\2\2GI\5\b\5\2HG\3\2\2\2IL\3\2\2\2")
        buf.write("JH\3\2\2\2JK\3\2\2\2KP\3\2\2\2LJ\3\2\2\2MO\5\n\6\2NM\3")
        buf.write("\2\2\2OR\3\2\2\2PN\3\2\2\2PQ\3\2\2\2QT\3\2\2\2RP\3\2\2")
        buf.write("\2SU\5\60\31\2TS\3\2\2\2TU\3\2\2\2UV\3\2\2\2VW\7\2\2\3")
        buf.write("W\3\3\2\2\2XY\7\t\2\2Y[\5\32\16\2Z\\\5\6\4\2[Z\3\2\2\2")
        buf.write("[\\\3\2\2\2\\]\3\2\2\2]^\7\25\2\2^\5\3\2\2\2_a\7\26\2")
        buf.write("\2`b\5,\27\2a`\3\2\2\2bc\3\2\2\2ca\3\2\2\2cd\3\2\2\2d")
        buf.write("\7\3\2\2\2ei\7\n\2\2fh\5\32\16\2gf\3\2\2\2hk\3\2\2\2i")
        buf.write("g\3\2\2\2ij\3\2\2\2jl\3\2\2\2ki\3\2\2\2lm\7\25\2\2m\t")
        buf.write("\3\2\2\2ns\5\f\7\2os\5\34\17\2ps\5 \21\2qs\5\"\22\2rn")
        buf.write("\3\2\2\2ro\3\2\2\2rp\3\2\2\2rq\3\2\2\2s\13\3\2\2\2tu\7")
        buf.write("\4\2\2uv\5\16\b\2v\r\3\2\2\2wy\7\27\2\2xz\5\20\t\2yx\3")
        buf.write("\2\2\2yz\3\2\2\2z{\3\2\2\2{\u0088\7\30\2\2|~\7\27\2\2")
        buf.write("}\177\t\2\2\2~}\3\2\2\2~\177\3\2\2\2\177\u0080\3\2\2\2")
        buf.write("\u0080\u0081\7\13\2\2\u0081\u0083\5&\24\2\u0082\u0084")
        buf.write("\5.\30\2\u0083\u0082\3\2\2\2\u0083\u0084\3\2\2\2\u0084")
        buf.write("\u0085\3\2\2\2\u0085\u0086\7\30\2\2\u0086\u0088\3\2\2")
        buf.write("\2\u0087w\3\2\2\2\u0087|\3\2\2\2\u0088\17\3\2\2\2\u0089")
        buf.write("\u009b\7\31\2\2\u008a\u008c\5\24\13\2\u008b\u008a\3\2")
        buf.write("\2\2\u008c\u008d\3\2\2\2\u008d\u008b\3\2\2\2\u008d\u008e")
        buf.write("\3\2\2\2\u008e\u0093\3\2\2\2\u008f\u0090\7\37\2\2\u0090")
        buf.write("\u0092\5\22\n\2\u0091\u008f\3\2\2\2\u0092\u0095\3\2\2")
        buf.write("\2\u0093\u0091\3\2\2\2\u0093\u0094\3\2\2\2\u0094\u0098")
        buf.write("\3\2\2\2\u0095\u0093\3\2\2\2\u0096\u0097\7\37\2\2\u0097")
        buf.write("\u0099\5\26\f\2\u0098\u0096\3\2\2\2\u0098\u0099\3\2\2")
        buf.write("\2\u0099\u009b\3\2\2\2\u009a\u0089\3\2\2\2\u009a\u008b")
        buf.write("\3\2\2\2\u009b\21\3\2\2\2\u009c\u009e\5\24\13\2\u009d")
        buf.write("\u009c\3\2\2\2\u009e\u00a1\3\2\2\2\u009f\u009d\3\2\2\2")
        buf.write("\u009f\u00a0\3\2\2\2\u00a0\23\3\2\2\2\u00a1\u009f\3\2")
        buf.write("\2\2\u00a2\u00a4\5\30\r\2\u00a3\u00a5\7\31\2\2\u00a4\u00a3")
        buf.write("\3\2\2\2\u00a4\u00a5\3\2\2\2\u00a5\25\3\2\2\2\u00a6\u00a7")
        buf.write("\7\31\2\2\u00a7\27\3\2\2\2\u00a8\u00a9\5\32\16\2\u00a9")
        buf.write("\u00aa\7 \2\2\u00aa\u00ac\5&\24\2\u00ab\u00ad\5.\30\2")
        buf.write("\u00ac\u00ab\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad\u00bf\3")
        buf.write("\2\2\2\u00ae\u00b0\5,\27\2\u00af\u00b1\5.\30\2\u00b0\u00af")
        buf.write("\3\2\2\2\u00b0\u00b1\3\2\2\2\u00b1\u00bf\3\2\2\2\u00b2")
        buf.write("\u00b4\7\35\2\2\u00b3\u00b5\5\32\16\2\u00b4\u00b3\3\2")
        buf.write("\2\2\u00b5\u00b6\3\2\2\2\u00b6\u00b4\3\2\2\2\u00b6\u00b7")
        buf.write("\3\2\2\2\u00b7\u00b8\3\2\2\2\u00b8\u00b9\7\36\2\2\u00b9")
        buf.write("\u00ba\7 \2\2\u00ba\u00bc\5&\24\2\u00bb\u00bd\5.\30\2")
        buf.write("\u00bc\u00bb\3\2\2\2\u00bc\u00bd\3\2\2\2\u00bd\u00bf\3")
        buf.write("\2\2\2\u00be\u00a8\3\2\2\2\u00be\u00ae\3\2\2\2\u00be\u00b2")
        buf.write("\3\2\2\2\u00bf\31\3\2\2\2\u00c0\u00c1\t\3\2\2\u00c1\33")
        buf.write("\3\2\2\2\u00c2\u00c3\7\4\2\2\u00c3\u00c4\5\36\20\2\u00c4")
        buf.write("\35\3\2\2\2\u00c5\u00c6\7\23\2\2\u00c6\u00cb\5&\24\2\u00c7")
        buf.write("\u00c8\7\37\2\2\u00c8\u00ca\5&\24\2\u00c9\u00c7\3\2\2")
        buf.write("\2\u00ca\u00cd\3\2\2\2\u00cb\u00c9\3\2\2\2\u00cb\u00cc")
        buf.write("\3\2\2\2\u00cc\u00cf\3\2\2\2\u00cd\u00cb\3\2\2\2\u00ce")
        buf.write("\u00d0\5.\30\2\u00cf\u00ce\3\2\2\2\u00cf\u00d0\3\2\2\2")
        buf.write("\u00d0\u00d1\3\2\2\2\u00d1\u00d2\7\24\2\2\u00d2\37\3\2")
        buf.write("\2\2\u00d3\u00d4\7\4\2\2\u00d4\u00d5\7!\2\2\u00d5\u00d6")
        buf.write("\5\20\t\2\u00d6\u00d7\7\25\2\2\u00d7!\3\2\2\2\u00d8\u00d9")
        buf.write("\7\4\2\2\u00d9\u00da\7!\2\2\u00da\u00df\5(\25\2\u00db")
        buf.write("\u00dc\7\37\2\2\u00dc\u00de\5(\25\2\u00dd\u00db\3\2\2")
        buf.write("\2\u00de\u00e1\3\2\2\2\u00df\u00dd\3\2\2\2\u00df\u00e0")
        buf.write("\3\2\2\2\u00e0\u00e2\3\2\2\2\u00e1\u00df\3\2\2\2\u00e2")
        buf.write("\u00e3\7\25\2\2\u00e3#\3\2\2\2\u00e4\u00e5\t\4\2\2\u00e5")
        buf.write("%\3\2\2\2\u00e6\u00e9\5,\27\2\u00e7\u00e9\5(\25\2\u00e8")
        buf.write("\u00e6\3\2\2\2\u00e8\u00e7\3\2\2\2\u00e9\'\3\2\2\2\u00ea")
        buf.write("\u00f4\7\3\2\2\u00eb\u00f4\7\5\2\2\u00ec\u00f4\5$\23\2")
        buf.write("\u00ed\u00f4\5\16\b\2\u00ee\u00f4\5\36\20\2\u00ef\u00f0")
        buf.write("\7\35\2\2\u00f0\u00f1\5*\26\2\u00f1\u00f2\7\36\2\2\u00f2")
        buf.write("\u00f4\3\2\2\2\u00f3\u00ea\3\2\2\2\u00f3\u00eb\3\2\2\2")
        buf.write("\u00f3\u00ec\3\2\2\2\u00f3\u00ed\3\2\2\2\u00f3\u00ee\3")
        buf.write("\2\2\2\u00f3\u00ef\3\2\2\2\u00f4)\3\2\2\2\u00f5\u00f8")
        buf.write("\5&\24\2\u00f6\u00f7\7\37\2\2\u00f7\u00f9\5&\24\2\u00f8")
        buf.write("\u00f6\3\2\2\2\u00f9\u00fa\3\2\2\2\u00fa\u00f8\3\2\2\2")
        buf.write("\u00fa\u00fb\3\2\2\2\u00fb+\3\2\2\2\u00fc\u00fd\7\4\2")
        buf.write("\2\u00fd-\3\2\2\2\u00fe\u010b\7\33\2\2\u00ff\u010b\7\32")
        buf.write("\2\2\u0100\u010b\7\34\2\2\u0101\u0102\7\27\2\2\u0102\u0107")
        buf.write("\7\6\2\2\u0103\u0105\7\31\2\2\u0104\u0106\t\5\2\2\u0105")
        buf.write("\u0104\3\2\2\2\u0105\u0106\3\2\2\2\u0106\u0108\3\2\2\2")
        buf.write("\u0107\u0103\3\2\2\2\u0107\u0108\3\2\2\2\u0108\u0109\3")
        buf.write("\2\2\2\u0109\u010b\7\30\2\2\u010a\u00fe\3\2\2\2\u010a")
        buf.write("\u00ff\3\2\2\2\u010a\u0100\3\2\2\2\u010a\u0101\3\2\2\2")
        buf.write("\u010b/\3\2\2\2\u010c\u0110\7\b\2\2\u010d\u010f\5\62\32")
        buf.write("\2\u010e\u010d\3\2\2\2\u010f\u0112\3\2\2\2\u0110\u010e")
        buf.write("\3\2\2\2\u0110\u0111\3\2\2\2\u0111\61\3\2\2\2\u0112\u0110")
        buf.write("\3\2\2\2\u0113\u0114\7$\2\2\u0114\u0115\7 \2\2\u0115\u0116")
        buf.write("\5\64\33\2\u0116\u0117\7\25\2\2\u0117\63\3\2\2\2\u0118")
        buf.write("\u011a\5\66\34\2\u0119\u011b\5$\23\2\u011a\u0119\3\2\2")
        buf.write("\2\u011a\u011b\3\2\2\2\u011b\65\3\2\2\2\u011c\u0121\5")
        buf.write("8\35\2\u011d\u011e\7\37\2\2\u011e\u0120\58\35\2\u011f")
        buf.write("\u011d\3\2\2\2\u0120\u0123\3\2\2\2\u0121\u011f\3\2\2\2")
        buf.write("\u0121\u0122\3\2\2\2\u0122\67\3\2\2\2\u0123\u0121\3\2")
        buf.write("\2\2\u0124\u0127\5:\36\2\u0125\u0127\3\2\2\2\u0126\u0124")
        buf.write("\3\2\2\2\u0126\u0125\3\2\2\2\u01279\3\2\2\2\u0128\u012a")
        buf.write("\5<\37\2\u0129\u0128\3\2\2\2\u012a\u012b\3\2\2\2\u012b")
        buf.write("\u0129\3\2\2\2\u012b\u012c\3\2\2\2\u012c;\3\2\2\2\u012d")
        buf.write("\u012f\5@!\2\u012e\u0130\5.\30\2\u012f\u012e\3\2\2\2\u012f")
        buf.write("\u0130\3\2\2\2\u0130\u0136\3\2\2\2\u0131\u0133\5> \2\u0132")
        buf.write("\u0134\5.\30\2\u0133\u0132\3\2\2\2\u0133\u0134\3\2\2\2")
        buf.write("\u0134\u0136\3\2\2\2\u0135\u012d\3\2\2\2\u0135\u0131\3")
        buf.write("\2\2\2\u0136=\3\2\2\2\u0137\u0138\7\35\2\2\u0138\u0139")
        buf.write("\5\66\34\2\u0139\u013a\7\36\2\2\u013a?\3\2\2\2\u013b\u013f")
        buf.write("\5B\"\2\u013c\u013f\7%\2\2\u013d\u013f\7\7\2\2\u013e\u013b")
        buf.write("\3\2\2\2\u013e\u013c\3\2\2\2\u013e\u013d\3\2\2\2\u013f")
        buf.write("A\3\2\2\2\u0140\u0141\t\6\2\2\u0141C\3\2\2\2+EJPT[cir")
        buf.write("y~\u0083\u0087\u008d\u0093\u0098\u009a\u009f\u00a4\u00ac")
        buf.write("\u00b0\u00b6\u00bc\u00be\u00cb\u00cf\u00df\u00e8\u00f3")
        buf.write("\u00fa\u0105\u0107\u010a\u0110\u011a\u0121\u0126\u012b")
        buf.write("\u012f\u0133\u0135\u013e")
        return buf.getvalue()


class jsgParser ( Parser ):

    grammarFileName = "jsgParser.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "'@terminals'", "'.TYPE'", 
                     "'.IGNORE'", "'->'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'['", "']'", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "'='" ]

    symbolicNames = [ "<INVALID>", "LEXER_ID_REF", "ID", "STRING", "INT", 
                      "ANY", "TERMINALS", "TYPE", "IGNORE", "MAPSTO", "JSON_STRING", 
                      "JSON_NUMBER", "JSON_INT", "JSON_BOOL", "JSON_NULL", 
                      "JSON_ARRAY", "JSON_OBJECT", "OBRACKET", "CBRACKET", 
                      "SEMI", "DASH", "OBRACE", "CBRACE", "COMMA", "STAR", 
                      "QMARK", "PLUS", "OPREN", "CPREN", "BAR", "COLON", 
                      "EQUALS", "PASS", "COMMENT", "LEXER_ID", "LEXER_CHAR_SET", 
                      "LEXER_PASS", "LEXER_COMMENT" ]

    RULE_doc = 0
    RULE_typeDirective = 1
    RULE_typeExceptions = 2
    RULE_ignoreDirective = 3
    RULE_grammarElt = 4
    RULE_objectDef = 5
    RULE_objectExpr = 6
    RULE_membersDef = 7
    RULE_altMemberDef = 8
    RULE_member = 9
    RULE_lastComma = 10
    RULE_pairDef = 11
    RULE_name = 12
    RULE_arrayDef = 13
    RULE_arrayExpr = 14
    RULE_objectMacro = 15
    RULE_valueTypeMacro = 16
    RULE_builtinValueType = 17
    RULE_valueType = 18
    RULE_nonRefValueType = 19
    RULE_typeAlternatives = 20
    RULE_idref = 21
    RULE_ebnfSuffix = 22
    RULE_lexerRules = 23
    RULE_lexerRuleSpec = 24
    RULE_lexerRuleBlock = 25
    RULE_lexerAltList = 26
    RULE_lexerAlt = 27
    RULE_lexerElements = 28
    RULE_lexerElement = 29
    RULE_lexerBlock = 30
    RULE_lexerAtom = 31
    RULE_lexerTerminal = 32

    ruleNames =  [ "doc", "typeDirective", "typeExceptions", "ignoreDirective", 
                   "grammarElt", "objectDef", "objectExpr", "membersDef", 
                   "altMemberDef", "member", "lastComma", "pairDef", "name", 
                   "arrayDef", "arrayExpr", "objectMacro", "valueTypeMacro", 
                   "builtinValueType", "valueType", "nonRefValueType", "typeAlternatives", 
                   "idref", "ebnfSuffix", "lexerRules", "lexerRuleSpec", 
                   "lexerRuleBlock", "lexerAltList", "lexerAlt", "lexerElements", 
                   "lexerElement", "lexerBlock", "lexerAtom", "lexerTerminal" ]

    EOF = Token.EOF
    LEXER_ID_REF=1
    ID=2
    STRING=3
    INT=4
    ANY=5
    TERMINALS=6
    TYPE=7
    IGNORE=8
    MAPSTO=9
    JSON_STRING=10
    JSON_NUMBER=11
    JSON_INT=12
    JSON_BOOL=13
    JSON_NULL=14
    JSON_ARRAY=15
    JSON_OBJECT=16
    OBRACKET=17
    CBRACKET=18
    SEMI=19
    DASH=20
    OBRACE=21
    CBRACE=22
    COMMA=23
    STAR=24
    QMARK=25
    PLUS=26
    OPREN=27
    CPREN=28
    BAR=29
    COLON=30
    EQUALS=31
    PASS=32
    COMMENT=33
    LEXER_ID=34
    LEXER_CHAR_SET=35
    LEXER_PASS=36
    LEXER_COMMENT=37

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.9")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class DocContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EOF(self):
            return self.getToken(jsgParser.EOF, 0)

        def typeDirective(self):
            return self.getTypedRuleContext(jsgParser.TypeDirectiveContext,0)


        def ignoreDirective(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.IgnoreDirectiveContext)
            else:
                return self.getTypedRuleContext(jsgParser.IgnoreDirectiveContext,i)


        def grammarElt(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.GrammarEltContext)
            else:
                return self.getTypedRuleContext(jsgParser.GrammarEltContext,i)


        def lexerRules(self):
            return self.getTypedRuleContext(jsgParser.LexerRulesContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_doc

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDoc" ):
                return visitor.visitDoc(self)
            else:
                return visitor.visitChildren(self)




    def doc(self):

        localctx = jsgParser.DocContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_doc)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 67
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.TYPE:
                self.state = 66
                self.typeDirective()


            self.state = 72
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.IGNORE:
                self.state = 69
                self.ignoreDirective()
                self.state = 74
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 78
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.ID:
                self.state = 75
                self.grammarElt()
                self.state = 80
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 82
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.TERMINALS:
                self.state = 81
                self.lexerRules()


            self.state = 84
            self.match(jsgParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeDirectiveContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def TYPE(self):
            return self.getToken(jsgParser.TYPE, 0)

        def name(self):
            return self.getTypedRuleContext(jsgParser.NameContext,0)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def typeExceptions(self):
            return self.getTypedRuleContext(jsgParser.TypeExceptionsContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_typeDirective

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeDirective" ):
                return visitor.visitTypeDirective(self)
            else:
                return visitor.visitChildren(self)




    def typeDirective(self):

        localctx = jsgParser.TypeDirectiveContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_typeDirective)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 86
            self.match(jsgParser.TYPE)
            self.state = 87
            self.name()
            self.state = 89
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.DASH:
                self.state = 88
                self.typeExceptions()


            self.state = 91
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeExceptionsContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def DASH(self):
            return self.getToken(jsgParser.DASH, 0)

        def idref(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.IdrefContext)
            else:
                return self.getTypedRuleContext(jsgParser.IdrefContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_typeExceptions

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeExceptions" ):
                return visitor.visitTypeExceptions(self)
            else:
                return visitor.visitChildren(self)




    def typeExceptions(self):

        localctx = jsgParser.TypeExceptionsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_typeExceptions)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 93
            self.match(jsgParser.DASH)
            self.state = 95 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 94
                self.idref()
                self.state = 97 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==jsgParser.ID):
                    break

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IgnoreDirectiveContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IGNORE(self):
            return self.getToken(jsgParser.IGNORE, 0)

        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.NameContext)
            else:
                return self.getTypedRuleContext(jsgParser.NameContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_ignoreDirective

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIgnoreDirective" ):
                return visitor.visitIgnoreDirective(self)
            else:
                return visitor.visitChildren(self)




    def ignoreDirective(self):

        localctx = jsgParser.IgnoreDirectiveContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_ignoreDirective)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 99
            self.match(jsgParser.IGNORE)
            self.state = 103
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.ID or _la==jsgParser.STRING:
                self.state = 100
                self.name()
                self.state = 105
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 106
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class GrammarEltContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def objectDef(self):
            return self.getTypedRuleContext(jsgParser.ObjectDefContext,0)


        def arrayDef(self):
            return self.getTypedRuleContext(jsgParser.ArrayDefContext,0)


        def objectMacro(self):
            return self.getTypedRuleContext(jsgParser.ObjectMacroContext,0)


        def valueTypeMacro(self):
            return self.getTypedRuleContext(jsgParser.ValueTypeMacroContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_grammarElt

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitGrammarElt" ):
                return visitor.visitGrammarElt(self)
            else:
                return visitor.visitChildren(self)




    def grammarElt(self):

        localctx = jsgParser.GrammarEltContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_grammarElt)
        try:
            self.state = 112
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,7,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 108
                self.objectDef()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 109
                self.arrayDef()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 110
                self.objectMacro()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 111
                self.valueTypeMacro()
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ObjectDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def objectExpr(self):
            return self.getTypedRuleContext(jsgParser.ObjectExprContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_objectDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitObjectDef" ):
                return visitor.visitObjectDef(self)
            else:
                return visitor.visitChildren(self)




    def objectDef(self):

        localctx = jsgParser.ObjectDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_objectDef)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 114
            self.match(jsgParser.ID)
            self.state = 115
            self.objectExpr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ObjectExprContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OBRACE(self):
            return self.getToken(jsgParser.OBRACE, 0)

        def CBRACE(self):
            return self.getToken(jsgParser.CBRACE, 0)

        def membersDef(self):
            return self.getTypedRuleContext(jsgParser.MembersDefContext,0)


        def MAPSTO(self):
            return self.getToken(jsgParser.MAPSTO, 0)

        def valueType(self):
            return self.getTypedRuleContext(jsgParser.ValueTypeContext,0)


        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def LEXER_ID_REF(self):
            return self.getToken(jsgParser.LEXER_ID_REF, 0)

        def ANY(self):
            return self.getToken(jsgParser.ANY, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_objectExpr

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitObjectExpr" ):
                return visitor.visitObjectExpr(self)
            else:
                return visitor.visitChildren(self)




    def objectExpr(self):

        localctx = jsgParser.ObjectExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_objectExpr)
        self._la = 0 # Token type
        try:
            self.state = 133
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,11,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 117
                self.match(jsgParser.OBRACE)
                self.state = 119
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ID) | (1 << jsgParser.STRING) | (1 << jsgParser.COMMA) | (1 << jsgParser.OPREN))) != 0):
                    self.state = 118
                    self.membersDef()


                self.state = 121
                self.match(jsgParser.CBRACE)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 122
                self.match(jsgParser.OBRACE)
                self.state = 124
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==jsgParser.LEXER_ID_REF or _la==jsgParser.ANY:
                    self.state = 123
                    _la = self._input.LA(1)
                    if not(_la==jsgParser.LEXER_ID_REF or _la==jsgParser.ANY):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()


                self.state = 126
                self.match(jsgParser.MAPSTO)
                self.state = 127
                self.valueType()
                self.state = 129
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 128
                    self.ebnfSuffix()


                self.state = 131
                self.match(jsgParser.CBRACE)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MembersDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def member(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.MemberContext)
            else:
                return self.getTypedRuleContext(jsgParser.MemberContext,i)


        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def altMemberDef(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.AltMemberDefContext)
            else:
                return self.getTypedRuleContext(jsgParser.AltMemberDefContext,i)


        def lastComma(self):
            return self.getTypedRuleContext(jsgParser.LastCommaContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_membersDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMembersDef" ):
                return visitor.visitMembersDef(self)
            else:
                return visitor.visitChildren(self)




    def membersDef(self):

        localctx = jsgParser.MembersDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_membersDef)
        self._la = 0 # Token type
        try:
            self.state = 152
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.COMMA]:
                self.enterOuterAlt(localctx, 1)
                self.state = 135
                self.match(jsgParser.COMMA)
                pass
            elif token in [jsgParser.ID, jsgParser.STRING, jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 137 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 136
                    self.member()
                    self.state = 139 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ID) | (1 << jsgParser.STRING) | (1 << jsgParser.OPREN))) != 0)):
                        break

                self.state = 145
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,13,self._ctx)
                while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                    if _alt==1:
                        self.state = 141
                        self.match(jsgParser.BAR)
                        self.state = 142
                        self.altMemberDef() 
                    self.state = 147
                    self._errHandler.sync(self)
                    _alt = self._interp.adaptivePredict(self._input,13,self._ctx)

                self.state = 150
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==jsgParser.BAR:
                    self.state = 148
                    self.match(jsgParser.BAR)
                    self.state = 149
                    self.lastComma()


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AltMemberDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def member(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.MemberContext)
            else:
                return self.getTypedRuleContext(jsgParser.MemberContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_altMemberDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitAltMemberDef" ):
                return visitor.visitAltMemberDef(self)
            else:
                return visitor.visitChildren(self)




    def altMemberDef(self):

        localctx = jsgParser.AltMemberDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_altMemberDef)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ID) | (1 << jsgParser.STRING) | (1 << jsgParser.OPREN))) != 0):
                self.state = 154
                self.member()
                self.state = 159
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class MemberContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def pairDef(self):
            return self.getTypedRuleContext(jsgParser.PairDefContext,0)


        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_member

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitMember" ):
                return visitor.visitMember(self)
            else:
                return visitor.visitChildren(self)




    def member(self):

        localctx = jsgParser.MemberContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_member)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 160
            self.pairDef()
            self.state = 162
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==jsgParser.COMMA:
                self.state = 161
                self.match(jsgParser.COMMA)


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LastCommaContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lastComma

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLastComma" ):
                return visitor.visitLastComma(self)
            else:
                return visitor.visitChildren(self)




    def lastComma(self):

        localctx = jsgParser.LastCommaContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_lastComma)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 164
            self.match(jsgParser.COMMA)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class PairDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def name(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.NameContext)
            else:
                return self.getTypedRuleContext(jsgParser.NameContext,i)


        def COLON(self):
            return self.getToken(jsgParser.COLON, 0)

        def valueType(self):
            return self.getTypedRuleContext(jsgParser.ValueTypeContext,0)


        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def idref(self):
            return self.getTypedRuleContext(jsgParser.IdrefContext,0)


        def OPREN(self):
            return self.getToken(jsgParser.OPREN, 0)

        def CPREN(self):
            return self.getToken(jsgParser.CPREN, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_pairDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitPairDef" ):
                return visitor.visitPairDef(self)
            else:
                return visitor.visitChildren(self)




    def pairDef(self):

        localctx = jsgParser.PairDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_pairDef)
        self._la = 0 # Token type
        try:
            self.state = 188
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,22,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 166
                self.name()
                self.state = 167
                self.match(jsgParser.COLON)
                self.state = 168
                self.valueType()
                self.state = 170
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 169
                    self.ebnfSuffix()


                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 172
                self.idref()
                self.state = 174
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 173
                    self.ebnfSuffix()


                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 176
                self.match(jsgParser.OPREN)
                self.state = 178 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while True:
                    self.state = 177
                    self.name()
                    self.state = 180 
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if not (_la==jsgParser.ID or _la==jsgParser.STRING):
                        break

                self.state = 182
                self.match(jsgParser.CPREN)
                self.state = 183
                self.match(jsgParser.COLON)
                self.state = 184
                self.valueType()
                self.state = 186
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 185
                    self.ebnfSuffix()


                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NameContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def STRING(self):
            return self.getToken(jsgParser.STRING, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_name

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitName" ):
                return visitor.visitName(self)
            else:
                return visitor.visitChildren(self)




    def name(self):

        localctx = jsgParser.NameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_name)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 190
            _la = self._input.LA(1)
            if not(_la==jsgParser.ID or _la==jsgParser.STRING):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayDefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def arrayExpr(self):
            return self.getTypedRuleContext(jsgParser.ArrayExprContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_arrayDef

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayDef" ):
                return visitor.visitArrayDef(self)
            else:
                return visitor.visitChildren(self)




    def arrayDef(self):

        localctx = jsgParser.ArrayDefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_arrayDef)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 192
            self.match(jsgParser.ID)
            self.state = 193
            self.arrayExpr()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ArrayExprContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OBRACKET(self):
            return self.getToken(jsgParser.OBRACKET, 0)

        def valueType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.ValueTypeContext)
            else:
                return self.getTypedRuleContext(jsgParser.ValueTypeContext,i)


        def CBRACKET(self):
            return self.getToken(jsgParser.CBRACKET, 0)

        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_arrayExpr

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitArrayExpr" ):
                return visitor.visitArrayExpr(self)
            else:
                return visitor.visitChildren(self)




    def arrayExpr(self):

        localctx = jsgParser.ArrayExprContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_arrayExpr)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            self.match(jsgParser.OBRACKET)
            self.state = 196
            self.valueType()
            self.state = 201
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.BAR:
                self.state = 197
                self.match(jsgParser.BAR)
                self.state = 198
                self.valueType()
                self.state = 203
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 205
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                self.state = 204
                self.ebnfSuffix()


            self.state = 207
            self.match(jsgParser.CBRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ObjectMacroContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def EQUALS(self):
            return self.getToken(jsgParser.EQUALS, 0)

        def membersDef(self):
            return self.getTypedRuleContext(jsgParser.MembersDefContext,0)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_objectMacro

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitObjectMacro" ):
                return visitor.visitObjectMacro(self)
            else:
                return visitor.visitChildren(self)




    def objectMacro(self):

        localctx = jsgParser.ObjectMacroContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_objectMacro)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(jsgParser.ID)
            self.state = 210
            self.match(jsgParser.EQUALS)
            self.state = 211
            self.membersDef()
            self.state = 212
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueTypeMacroContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def EQUALS(self):
            return self.getToken(jsgParser.EQUALS, 0)

        def nonRefValueType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.NonRefValueTypeContext)
            else:
                return self.getTypedRuleContext(jsgParser.NonRefValueTypeContext,i)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def getRuleIndex(self):
            return jsgParser.RULE_valueTypeMacro

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitValueTypeMacro" ):
                return visitor.visitValueTypeMacro(self)
            else:
                return visitor.visitChildren(self)




    def valueTypeMacro(self):

        localctx = jsgParser.ValueTypeMacroContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_valueTypeMacro)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 214
            self.match(jsgParser.ID)
            self.state = 215
            self.match(jsgParser.EQUALS)
            self.state = 216
            self.nonRefValueType()
            self.state = 221
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.BAR:
                self.state = 217
                self.match(jsgParser.BAR)
                self.state = 218
                self.nonRefValueType()
                self.state = 223
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 224
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class BuiltinValueTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def JSON_STRING(self):
            return self.getToken(jsgParser.JSON_STRING, 0)

        def JSON_NUMBER(self):
            return self.getToken(jsgParser.JSON_NUMBER, 0)

        def JSON_INT(self):
            return self.getToken(jsgParser.JSON_INT, 0)

        def JSON_BOOL(self):
            return self.getToken(jsgParser.JSON_BOOL, 0)

        def JSON_NULL(self):
            return self.getToken(jsgParser.JSON_NULL, 0)

        def JSON_ARRAY(self):
            return self.getToken(jsgParser.JSON_ARRAY, 0)

        def JSON_OBJECT(self):
            return self.getToken(jsgParser.JSON_OBJECT, 0)

        def ANY(self):
            return self.getToken(jsgParser.ANY, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_builtinValueType

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitBuiltinValueType" ):
                return visitor.visitBuiltinValueType(self)
            else:
                return visitor.visitChildren(self)




    def builtinValueType(self):

        localctx = jsgParser.BuiltinValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_builtinValueType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 226
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ANY) | (1 << jsgParser.JSON_STRING) | (1 << jsgParser.JSON_NUMBER) | (1 << jsgParser.JSON_INT) | (1 << jsgParser.JSON_BOOL) | (1 << jsgParser.JSON_NULL) | (1 << jsgParser.JSON_ARRAY) | (1 << jsgParser.JSON_OBJECT))) != 0)):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def idref(self):
            return self.getTypedRuleContext(jsgParser.IdrefContext,0)


        def nonRefValueType(self):
            return self.getTypedRuleContext(jsgParser.NonRefValueTypeContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_valueType

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitValueType" ):
                return visitor.visitValueType(self)
            else:
                return visitor.visitChildren(self)




    def valueType(self):

        localctx = jsgParser.ValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_valueType)
        try:
            self.state = 230
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.ID]:
                self.enterOuterAlt(localctx, 1)
                self.state = 228
                self.idref()
                pass
            elif token in [jsgParser.LEXER_ID_REF, jsgParser.STRING, jsgParser.ANY, jsgParser.JSON_STRING, jsgParser.JSON_NUMBER, jsgParser.JSON_INT, jsgParser.JSON_BOOL, jsgParser.JSON_NULL, jsgParser.JSON_ARRAY, jsgParser.JSON_OBJECT, jsgParser.OBRACKET, jsgParser.OBRACE, jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 229
                self.nonRefValueType()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NonRefValueTypeContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LEXER_ID_REF(self):
            return self.getToken(jsgParser.LEXER_ID_REF, 0)

        def STRING(self):
            return self.getToken(jsgParser.STRING, 0)

        def builtinValueType(self):
            return self.getTypedRuleContext(jsgParser.BuiltinValueTypeContext,0)


        def objectExpr(self):
            return self.getTypedRuleContext(jsgParser.ObjectExprContext,0)


        def arrayExpr(self):
            return self.getTypedRuleContext(jsgParser.ArrayExprContext,0)


        def OPREN(self):
            return self.getToken(jsgParser.OPREN, 0)

        def typeAlternatives(self):
            return self.getTypedRuleContext(jsgParser.TypeAlternativesContext,0)


        def CPREN(self):
            return self.getToken(jsgParser.CPREN, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_nonRefValueType

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitNonRefValueType" ):
                return visitor.visitNonRefValueType(self)
            else:
                return visitor.visitChildren(self)




    def nonRefValueType(self):

        localctx = jsgParser.NonRefValueTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_nonRefValueType)
        try:
            self.state = 241
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.LEXER_ID_REF]:
                self.enterOuterAlt(localctx, 1)
                self.state = 232
                self.match(jsgParser.LEXER_ID_REF)
                pass
            elif token in [jsgParser.STRING]:
                self.enterOuterAlt(localctx, 2)
                self.state = 233
                self.match(jsgParser.STRING)
                pass
            elif token in [jsgParser.ANY, jsgParser.JSON_STRING, jsgParser.JSON_NUMBER, jsgParser.JSON_INT, jsgParser.JSON_BOOL, jsgParser.JSON_NULL, jsgParser.JSON_ARRAY, jsgParser.JSON_OBJECT]:
                self.enterOuterAlt(localctx, 3)
                self.state = 234
                self.builtinValueType()
                pass
            elif token in [jsgParser.OBRACE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 235
                self.objectExpr()
                pass
            elif token in [jsgParser.OBRACKET]:
                self.enterOuterAlt(localctx, 5)
                self.state = 236
                self.arrayExpr()
                pass
            elif token in [jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 6)
                self.state = 237
                self.match(jsgParser.OPREN)
                self.state = 238
                self.typeAlternatives()
                self.state = 239
                self.match(jsgParser.CPREN)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TypeAlternativesContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def valueType(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.ValueTypeContext)
            else:
                return self.getTypedRuleContext(jsgParser.ValueTypeContext,i)


        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def getRuleIndex(self):
            return jsgParser.RULE_typeAlternatives

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTypeAlternatives" ):
                return visitor.visitTypeAlternatives(self)
            else:
                return visitor.visitChildren(self)




    def typeAlternatives(self):

        localctx = jsgParser.TypeAlternativesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_typeAlternatives)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 243
            self.valueType()
            self.state = 246 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 244
                self.match(jsgParser.BAR)
                self.state = 245
                self.valueType()
                self.state = 248 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==jsgParser.BAR):
                    break

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IdrefContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def ID(self):
            return self.getToken(jsgParser.ID, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_idref

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitIdref" ):
                return visitor.visitIdref(self)
            else:
                return visitor.visitChildren(self)




    def idref(self):

        localctx = jsgParser.IdrefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_idref)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 250
            self.match(jsgParser.ID)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EbnfSuffixContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def QMARK(self):
            return self.getToken(jsgParser.QMARK, 0)

        def STAR(self):
            return self.getToken(jsgParser.STAR, 0)

        def PLUS(self):
            return self.getToken(jsgParser.PLUS, 0)

        def OBRACE(self):
            return self.getToken(jsgParser.OBRACE, 0)

        def INT(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.INT)
            else:
                return self.getToken(jsgParser.INT, i)

        def CBRACE(self):
            return self.getToken(jsgParser.CBRACE, 0)

        def COMMA(self):
            return self.getToken(jsgParser.COMMA, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_ebnfSuffix

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitEbnfSuffix" ):
                return visitor.visitEbnfSuffix(self)
            else:
                return visitor.visitChildren(self)




    def ebnfSuffix(self):

        localctx = jsgParser.EbnfSuffixContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_ebnfSuffix)
        self._la = 0 # Token type
        try:
            self.state = 264
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.QMARK]:
                self.enterOuterAlt(localctx, 1)
                self.state = 252
                self.match(jsgParser.QMARK)
                pass
            elif token in [jsgParser.STAR]:
                self.enterOuterAlt(localctx, 2)
                self.state = 253
                self.match(jsgParser.STAR)
                pass
            elif token in [jsgParser.PLUS]:
                self.enterOuterAlt(localctx, 3)
                self.state = 254
                self.match(jsgParser.PLUS)
                pass
            elif token in [jsgParser.OBRACE]:
                self.enterOuterAlt(localctx, 4)
                self.state = 255
                self.match(jsgParser.OBRACE)
                self.state = 256
                self.match(jsgParser.INT)
                self.state = 261
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==jsgParser.COMMA:
                    self.state = 257
                    self.match(jsgParser.COMMA)
                    self.state = 259
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==jsgParser.INT or _la==jsgParser.STAR:
                        self.state = 258
                        _la = self._input.LA(1)
                        if not(_la==jsgParser.INT or _la==jsgParser.STAR):
                            self._errHandler.recoverInline(self)
                        else:
                            self._errHandler.reportMatch(self)
                            self.consume()




                self.state = 263
                self.match(jsgParser.CBRACE)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerRulesContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def TERMINALS(self):
            return self.getToken(jsgParser.TERMINALS, 0)

        def lexerRuleSpec(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.LexerRuleSpecContext)
            else:
                return self.getTypedRuleContext(jsgParser.LexerRuleSpecContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerRules

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerRules" ):
                return visitor.visitLexerRules(self)
            else:
                return visitor.visitChildren(self)




    def lexerRules(self):

        localctx = jsgParser.LexerRulesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_lexerRules)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 266
            self.match(jsgParser.TERMINALS)
            self.state = 270
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.LEXER_ID:
                self.state = 267
                self.lexerRuleSpec()
                self.state = 272
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerRuleSpecContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LEXER_ID(self):
            return self.getToken(jsgParser.LEXER_ID, 0)

        def COLON(self):
            return self.getToken(jsgParser.COLON, 0)

        def lexerRuleBlock(self):
            return self.getTypedRuleContext(jsgParser.LexerRuleBlockContext,0)


        def SEMI(self):
            return self.getToken(jsgParser.SEMI, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerRuleSpec

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerRuleSpec" ):
                return visitor.visitLexerRuleSpec(self)
            else:
                return visitor.visitChildren(self)




    def lexerRuleSpec(self):

        localctx = jsgParser.LexerRuleSpecContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_lexerRuleSpec)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 273
            self.match(jsgParser.LEXER_ID)
            self.state = 274
            self.match(jsgParser.COLON)
            self.state = 275
            self.lexerRuleBlock()
            self.state = 276
            self.match(jsgParser.SEMI)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerRuleBlockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerAltList(self):
            return self.getTypedRuleContext(jsgParser.LexerAltListContext,0)


        def builtinValueType(self):
            return self.getTypedRuleContext(jsgParser.BuiltinValueTypeContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerRuleBlock

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerRuleBlock" ):
                return visitor.visitLexerRuleBlock(self)
            else:
                return visitor.visitChildren(self)




    def lexerRuleBlock(self):

        localctx = jsgParser.LexerRuleBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_lexerRuleBlock)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 278
            self.lexerAltList()
            self.state = 280
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.ANY) | (1 << jsgParser.JSON_STRING) | (1 << jsgParser.JSON_NUMBER) | (1 << jsgParser.JSON_INT) | (1 << jsgParser.JSON_BOOL) | (1 << jsgParser.JSON_NULL) | (1 << jsgParser.JSON_ARRAY) | (1 << jsgParser.JSON_OBJECT))) != 0):
                self.state = 279
                self.builtinValueType()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerAltListContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerAlt(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.LexerAltContext)
            else:
                return self.getTypedRuleContext(jsgParser.LexerAltContext,i)


        def BAR(self, i:int=None):
            if i is None:
                return self.getTokens(jsgParser.BAR)
            else:
                return self.getToken(jsgParser.BAR, i)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerAltList

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerAltList" ):
                return visitor.visitLexerAltList(self)
            else:
                return visitor.visitChildren(self)




    def lexerAltList(self):

        localctx = jsgParser.LexerAltListContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_lexerAltList)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 282
            self.lexerAlt()
            self.state = 287
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==jsgParser.BAR:
                self.state = 283
                self.match(jsgParser.BAR)
                self.state = 284
                self.lexerAlt()
                self.state = 289
                self._errHandler.sync(self)
                _la = self._input.LA(1)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerAltContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerElements(self):
            return self.getTypedRuleContext(jsgParser.LexerElementsContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerAlt

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerAlt" ):
                return visitor.visitLexerAlt(self)
            else:
                return visitor.visitChildren(self)




    def lexerAlt(self):

        localctx = jsgParser.LexerAltContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_lexerAlt)
        try:
            self.state = 292
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,35,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 290
                self.lexerElements()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)

                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerElementsContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerElement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(jsgParser.LexerElementContext)
            else:
                return self.getTypedRuleContext(jsgParser.LexerElementContext,i)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerElements

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerElements" ):
                return visitor.visitLexerElements(self)
            else:
                return visitor.visitChildren(self)




    def lexerElements(self):

        localctx = jsgParser.LexerElementsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_lexerElements)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 295 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 294
                    self.lexerElement()

                else:
                    raise NoViableAltException(self)
                self.state = 297 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,36,self._ctx)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerElementContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerAtom(self):
            return self.getTypedRuleContext(jsgParser.LexerAtomContext,0)


        def ebnfSuffix(self):
            return self.getTypedRuleContext(jsgParser.EbnfSuffixContext,0)


        def lexerBlock(self):
            return self.getTypedRuleContext(jsgParser.LexerBlockContext,0)


        def getRuleIndex(self):
            return jsgParser.RULE_lexerElement

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerElement" ):
                return visitor.visitLexerElement(self)
            else:
                return visitor.visitChildren(self)




    def lexerElement(self):

        localctx = jsgParser.LexerElementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_lexerElement)
        self._la = 0 # Token type
        try:
            self.state = 307
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.STRING, jsgParser.ANY, jsgParser.LEXER_ID, jsgParser.LEXER_CHAR_SET]:
                self.enterOuterAlt(localctx, 1)
                self.state = 299
                self.lexerAtom()
                self.state = 301
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 300
                    self.ebnfSuffix()


                pass
            elif token in [jsgParser.OPREN]:
                self.enterOuterAlt(localctx, 2)
                self.state = 303
                self.lexerBlock()
                self.state = 305
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << jsgParser.OBRACE) | (1 << jsgParser.STAR) | (1 << jsgParser.QMARK) | (1 << jsgParser.PLUS))) != 0):
                    self.state = 304
                    self.ebnfSuffix()


                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerBlockContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def OPREN(self):
            return self.getToken(jsgParser.OPREN, 0)

        def lexerAltList(self):
            return self.getTypedRuleContext(jsgParser.LexerAltListContext,0)


        def CPREN(self):
            return self.getToken(jsgParser.CPREN, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerBlock

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerBlock" ):
                return visitor.visitLexerBlock(self)
            else:
                return visitor.visitChildren(self)




    def lexerBlock(self):

        localctx = jsgParser.LexerBlockContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_lexerBlock)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 309
            self.match(jsgParser.OPREN)
            self.state = 310
            self.lexerAltList()
            self.state = 311
            self.match(jsgParser.CPREN)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerAtomContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def lexerTerminal(self):
            return self.getTypedRuleContext(jsgParser.LexerTerminalContext,0)


        def LEXER_CHAR_SET(self):
            return self.getToken(jsgParser.LEXER_CHAR_SET, 0)

        def ANY(self):
            return self.getToken(jsgParser.ANY, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerAtom

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerAtom" ):
                return visitor.visitLexerAtom(self)
            else:
                return visitor.visitChildren(self)




    def lexerAtom(self):

        localctx = jsgParser.LexerAtomContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_lexerAtom)
        try:
            self.state = 316
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [jsgParser.STRING, jsgParser.LEXER_ID]:
                self.enterOuterAlt(localctx, 1)
                self.state = 313
                self.lexerTerminal()
                pass
            elif token in [jsgParser.LEXER_CHAR_SET]:
                self.enterOuterAlt(localctx, 2)
                self.state = 314
                self.match(jsgParser.LEXER_CHAR_SET)
                pass
            elif token in [jsgParser.ANY]:
                self.enterOuterAlt(localctx, 3)
                self.state = 315
                self.match(jsgParser.ANY)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class LexerTerminalContext(ParserRuleContext):

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LEXER_ID(self):
            return self.getToken(jsgParser.LEXER_ID, 0)

        def STRING(self):
            return self.getToken(jsgParser.STRING, 0)

        def getRuleIndex(self):
            return jsgParser.RULE_lexerTerminal

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitLexerTerminal" ):
                return visitor.visitLexerTerminal(self)
            else:
                return visitor.visitChildren(self)




    def lexerTerminal(self):

        localctx = jsgParser.LexerTerminalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_lexerTerminal)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 318
            _la = self._input.LA(1)
            if not(_la==jsgParser.STRING or _la==jsgParser.LEXER_ID):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx






# Generated from jsgParser.g4 by ANTLR 4.9 # encoding: utf-8 #\3\2\2\2\u00e4\u00e5\t\4\2\2\u00e5") # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type # Token type