org.eolang.parser.ProgramLexer Maven / Gradle / Ivy
// Generated from org/eolang/parser/Program.g4 by ANTLR 4.8
package org.eolang.parser;
import java.util.LinkedList;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class ProgramLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.8", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
COMMENT=1, META=2, DOTS=3, CONST=4, SLASH=5, COLON=6, ARROW=7, SELF=8,
PLUS=9, MINUS=10, SPACE=11, DOT=12, LSQ=13, RSQ=14, LB=15, RB=16, AT=17,
PARENT=18, HASH=19, EOL=20, BYTES=21, BOOL=22, CHAR=23, STRING=24, INT=25,
FLOAT=26, HEX=27, NAME=28;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
public static String[] modeNames = {
"DEFAULT_MODE"
};
private static String[] makeRuleNames() {
return new String[] {
"COMMENT", "META", "DOTS", "CONST", "SLASH", "COLON", "ARROW", "SELF",
"PLUS", "MINUS", "SPACE", "DOT", "LSQ", "RSQ", "LB", "RB", "AT", "PARENT",
"HASH", "EOL", "BYTE", "BYTES", "BOOL", "CHAR", "STRING", "INT", "FLOAT",
"HEX", "NAME"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, null, null, "'...'", "'!'", "'/'", "':'", "'>'", "'$'", "'+'",
"'-'", "' '", "'.'", "'['", "']'", "'('", "')'", "'@'", "'^'", "'#'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, "COMMENT", "META", "DOTS", "CONST", "SLASH", "COLON", "ARROW",
"SELF", "PLUS", "MINUS", "SPACE", "DOT", "LSQ", "RSQ", "LB", "RB", "AT",
"PARENT", "HASH", "EOL", "BYTES", "BOOL", "CHAR", "STRING", "INT", "FLOAT",
"HEX", "NAME"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
private int currentTabs = 0;
private LinkedList tokens = new LinkedList<>();
@Override
public Token nextToken() {
return this.tokens.isEmpty() ? super.nextToken() : this.tokens.poll();
}
public void emitToken(int t, int line) {
CommonToken tkn = new CommonToken(t, "");
tkn.setLine(line);
this.tokens.offer(tkn);
}
public ProgramLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "Program.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getChannelNames() { return channelNames; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
@Override
public void action(RuleContext _localctx, int ruleIndex, int actionIndex) {
switch (ruleIndex) {
case 19:
EOL_action((RuleContext)_localctx, actionIndex);
break;
}
}
private void EOL_action(RuleContext _localctx, int actionIndex) {
switch (actionIndex) {
case 0:
int tabs = getText().replaceAll("[\r\n]+", "").length() / 2;
if (tabs < this.currentTabs) {
for (int i = 0; i < this.currentTabs - tabs; ++i) {
this.emitToken(ProgramParser.UNTAB, getLine() + 1);
this.emitToken(ProgramParser.EOL, getLine() + 1);
}
} else if (tabs > this.currentTabs) {
for (int i = 0; i < tabs - this.currentTabs; ++i) {
this.emitToken(ProgramParser.TAB, getLine() + 1);
}
}
this.currentTabs = tabs;
break;
}
}
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\36\u00cf\b\1\4\2"+
"\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\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\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+
"\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31"+
"\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\3\2\3\2\7\2@\n"+
"\2\f\2\16\2C\13\2\3\3\3\3\3\3\3\3\6\3I\n\3\r\3\16\3J\5\3M\n\3\3\4\3\4"+
"\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f"+
"\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\3\20\3\21\3\21\3\22\3\22\3\23\3"+
"\23\3\24\3\24\3\25\6\25t\n\25\r\25\16\25u\3\25\7\25y\n\25\f\25\16\25|"+
"\13\25\3\25\3\25\3\26\3\26\3\26\3\26\3\27\3\27\7\27\u0086\n\27\f\27\16"+
"\27\u0089\13\27\3\27\3\27\5\27\u008d\n\27\3\30\3\30\3\30\3\30\3\30\3\30"+
"\3\30\3\30\3\30\5\30\u0098\n\30\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32"+
"\7\32\u00a2\n\32\f\32\16\32\u00a5\13\32\3\32\3\32\3\33\3\33\5\33\u00ab"+
"\n\33\3\33\6\33\u00ae\n\33\r\33\16\33\u00af\3\34\3\34\5\34\u00b4\n\34"+
"\3\34\6\34\u00b7\n\34\r\34\16\34\u00b8\3\34\3\34\6\34\u00bd\n\34\r\34"+
"\16\34\u00be\3\35\3\35\3\35\3\35\6\35\u00c5\n\35\r\35\16\35\u00c6\3\36"+
"\3\36\7\36\u00cb\n\36\f\36\16\36\u00ce\13\36\2\2\37\3\3\5\4\7\5\t\6\13"+
"\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'"+
"\25)\26+\2-\27/\30\61\31\63\32\65\33\67\349\35;\36\3\2\n\4\2\f\f\17\17"+
"\4\2\62;CH\5\2\62;C\\c|\3\2$$\3\2\62;\4\2\62;ch\3\2c|\7\2//\62;C\\aac"+
"|\2\u00e0\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2"+
"\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27"+
"\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2"+
"\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2"+
"\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2"+
"\2\2\3=\3\2\2\2\5D\3\2\2\2\7N\3\2\2\2\tR\3\2\2\2\13T\3\2\2\2\rV\3\2\2"+
"\2\17X\3\2\2\2\21Z\3\2\2\2\23\\\3\2\2\2\25^\3\2\2\2\27`\3\2\2\2\31b\3"+
"\2\2\2\33d\3\2\2\2\35f\3\2\2\2\37h\3\2\2\2!j\3\2\2\2#l\3\2\2\2%n\3\2\2"+
"\2\'p\3\2\2\2)s\3\2\2\2+\177\3\2\2\2-\u0083\3\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2\2\2\u0088\u008a\3\2\2\2\u0089"+
"\u0087\3\2\2\2\u008a\u008b\t\3\2\2\u008b\u008d\t\3\2\2\u008c\u0087\3\2"+
"\2\2\u008c\u008d\3\2\2\2\u008d.\3\2\2\2\u008e\u008f\7v\2\2\u008f\u0090"+
"\7t\2\2\u0090\u0091\7w\2\2\u0091\u0098\7g\2\2\u0092\u0093\7h\2\2\u0093"+
"\u0094\7c\2\2\u0094\u0095\7n\2\2\u0095\u0096\7u\2\2\u0096\u0098\7g\2\2"+
"\u0097\u008e\3\2\2\2\u0097\u0092\3\2\2\2\u0098\60\3\2\2\2\u0099\u009a"+
"\7)\2\2\u009a\u009b\t\4\2\2\u009b\u009c\7)\2\2\u009c\62\3\2\2\2\u009d"+
"\u00a3\7$\2\2\u009e\u009f\7^\2\2\u009f\u00a2\7$\2\2\u00a0\u00a2\n\5\2"+
"\2\u00a1\u009e\3\2\2\2\u00a1\u00a0\3\2\2\2\u00a2\u00a5\3\2\2\2\u00a3\u00a1"+
"\3\2\2\2\u00a3\u00a4\3\2\2\2\u00a4\u00a6\3\2\2\2\u00a5\u00a3\3\2\2\2\u00a6"+
"\u00a7\7$\2\2\u00a7\64\3\2\2\2\u00a8\u00ab\5\23\n\2\u00a9\u00ab\5\25\13"+
"\2\u00aa\u00a8\3\2\2\2\u00aa\u00a9\3\2\2\2\u00aa\u00ab\3\2\2\2\u00ab\u00ad"+
"\3\2\2\2\u00ac\u00ae\t\6\2\2\u00ad\u00ac\3\2\2\2\u00ae\u00af\3\2\2\2\u00af"+
"\u00ad\3\2\2\2\u00af\u00b0\3\2\2\2\u00b0\66\3\2\2\2\u00b1\u00b4\5\23\n"+
"\2\u00b2\u00b4\5\25\13\2\u00b3\u00b1\3\2\2\2\u00b3\u00b2\3\2\2\2\u00b3"+
"\u00b4\3\2\2\2\u00b4\u00b6\3\2\2\2\u00b5\u00b7\t\6\2\2\u00b6\u00b5\3\2"+
"\2\2\u00b7\u00b8\3\2\2\2\u00b8\u00b6\3\2\2\2\u00b8\u00b9\3\2\2\2\u00b9"+
"\u00ba\3\2\2\2\u00ba\u00bc\5\31\r\2\u00bb\u00bd\t\6\2\2\u00bc\u00bb\3"+
"\2\2\2\u00bd\u00be\3\2\2\2\u00be\u00bc\3\2\2\2\u00be\u00bf\3\2\2\2\u00bf"+
"8\3\2\2\2\u00c0\u00c1\7\62\2\2\u00c1\u00c2\7z\2\2\u00c2\u00c4\3\2\2\2"+
"\u00c3\u00c5\t\7\2\2\u00c4\u00c3\3\2\2\2\u00c5\u00c6\3\2\2\2\u00c6\u00c4"+
"\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7:\3\2\2\2\u00c8\u00cc\t\b\2\2\u00c9"+
"\u00cb\t\t\2\2\u00ca\u00c9\3\2\2\2\u00cb\u00ce\3\2\2\2\u00cc\u00ca\3\2"+
"\2\2\u00cc\u00cd\3\2\2\2\u00cd<\3\2\2\2\u00ce\u00cc\3\2\2\2\24\2AJLuz"+
"\u0087\u008c\u0097\u00a1\u00a3\u00aa\u00af\u00b3\u00b8\u00be\u00c6\u00cc"+
"\3\3\25\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy