📄 actionlexer.java
字号:
protected final void mVAR_ASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = VAR_ASSIGN;
int _saveIndex;
match('=');
// inform the code generator that an assignment was done to
// AST root for the rule if invoker set refRuleRoot.
if ( LA(1)!='=' && transInfo!=null && transInfo.refRuleRoot!=null ) {
transInfo.assignToRoot=true;
}
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
protected final void mAST_CONSTRUCTOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = AST_CONSTRUCTOR;
int _saveIndex;
Token x=null;
Token y=null;
_saveIndex=text.length();
match('[');
text.setLength(_saveIndex);
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
break;
}
case '"': case '#': case '(': case '0':
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8':
case '9': case ':': case 'A': case 'B':
case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N':
case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V':
case 'W': case 'X': case 'Y': case 'Z':
case '[': case '_': case 'a': case 'b':
case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v':
case 'w': case 'x': case 'y': case 'z':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
_saveIndex=text.length();
mAST_CTOR_ELEMENT(true);
text.setLength(_saveIndex);
x=_returnToken;
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
break;
}
case ',': case ']':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
{
switch ( LA(1)) {
case ',':
{
_saveIndex=text.length();
match(',');
text.setLength(_saveIndex);
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
break;
}
case '"': case '#': case '(': case '0':
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8':
case '9': case ':': case 'A': case 'B':
case 'C': case 'D': case 'E': case 'F':
case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N':
case 'O': case 'P': case 'Q': case 'R':
case 'S': case 'T': case 'U': case 'V':
case 'W': case 'X': case 'Y': case 'Z':
case '[': case '_': case 'a': case 'b':
case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v':
case 'w': case 'x': case 'y': case 'z':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
_saveIndex=text.length();
mAST_CTOR_ELEMENT(true);
text.setLength(_saveIndex);
y=_returnToken;
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
break;
}
case ']':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
break;
}
case ']':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
_saveIndex=text.length();
match(']');
text.setLength(_saveIndex);
// System.out.println("AST_CONSTRUCTOR: "+((x==null)?"null":x.getText())+
// ", "+((y==null)?"null":y.getText()));
String ys = generator.processStringForASTConstructor(x.getText());
// the second does not need processing coz it's a string
// (eg second param of astFactory.create(x,y)
if ( y!=null )
ys += ","+y.getText();
text.setLength(_begin); text.append( generator.getASTCreateString(null,ys) );
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
protected final void mTEXT_ARG(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = TEXT_ARG;
int _saveIndex;
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
mWS(false);
break;
}
case '"': case '$': case '\'': case '+':
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9': case ':': case 'A':
case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I':
case 'J': case 'K': case 'L': case 'M':
case 'N': case 'O': case 'P': case 'Q':
case 'R': case 'S': case 'T': case 'U':
case 'V': case 'W': case 'X': case 'Y':
case 'Z': case '_': case 'a': case 'b':
case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r':
case 's': case 't': case 'u': case 'v':
case 'w': case 'x': case 'y': case 'z':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
{
int _cnt51=0;
_loop51:
do {
if ((_tokenSet_5.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
mTEXT_ARG_ELEMENT(false);
{
if ((_tokenSet_3.member(LA(1))) && (_tokenSet_6.member(LA(2)))) {
mWS(false);
}
else if ((_tokenSet_6.member(LA(1))) && (true)) {
}
else {
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
else {
if ( _cnt51>=1 ) { break _loop51; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());}
}
_cnt51++;
} while (true);
}
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
protected final void mTREE_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
int _ttype; Token _token=null; int _begin=text.length();
_ttype = TREE_ELEMENT;
int _saveIndex;
Token id=null;
boolean was_mapped;
switch ( LA(1)) {
case '(':
{
mTREE(false);
break;
}
case '[':
{
mAST_CONSTRUCTOR(false);
break;
}
case ':': case 'A': case 'B': case 'C':
case 'D': case 'E': case 'F': case 'G':
case 'H': case 'I': case 'J': case 'K':
case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S':
case 'T': case 'U': case 'V': case 'W':
case 'X': case 'Y': case 'Z': case '_':
case 'a': case 'b': case 'c': case 'd':
case 'e': case 'f': case 'g': case 'h':
case 'i': case 'j': case 'k': case 'l':
case 'm': case 'n': case 'o': case 'p':
case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
{
mID_ELEMENT(false);
break;
}
case '"':
{
mSTRING(false);
break;
}
default:
if ((LA(1)=='#') && (LA(2)=='(')) {
_saveIndex=text.length();
match('#');
text.setLength(_saveIndex);
mTREE(false);
}
else if ((LA(1)=='#') && (LA(2)=='[')) {
_saveIndex=text.length();
match('#');
text.setLength(_saveIndex);
mAST_CONSTRUCTOR(false);
}
else if ((LA(1)=='#') && (_tokenSet_2.member(LA(2)))) {
_saveIndex=text.length();
match('#');
text.setLength(_saveIndex);
was_mapped=mID_ELEMENT(true);
id=_returnToken;
// RK: I have a queer feeling that this maptreeid is redundant..
if ( ! was_mapped )
{
String t = generator.mapTreeId(id.getText(), null);
text.setLength(_begin); text.append(t);
}
}
else if ((LA(1)=='#') && (LA(2)=='#')) {
match("##");
String t = currentRule.getRuleName()+"_AST"; text.setLength(_begin); text.append(t);
}
else {
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
_token = makeToken(_ttype);
_token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
}
_returnToken = _token;
}
/** An ID_ELEMENT can be a func call, array ref, simple var,
* or AST label ref.
*/
protected final boolean mID_ELEMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
boolean mapped=false;
int _ttype; Token _token=null; int _begin=text.length();
_ttype = ID_ELEMENT;
int _saveIndex;
Token id=null;
mID(true);
id=_returnToken;
{
if ((_tokenSet_3.member(LA(1))) && (_tokenSet_7.member(LA(2)))) {
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
}
else if ((_tokenSet_7.member(LA(1))) && (true)) {
}
else {
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
{
switch ( LA(1)) {
case '(': case '<':
{
{
switch ( LA(1)) {
case '<':
{
match('<');
{
_loop34:
do {
if ((_tokenSet_8.member(LA(1)))) {
matchNot('>');
}
else {
break _loop34;
}
} while (true);
}
match('>');
break;
}
case '(':
{
break;
}
default:
{
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
}
match('(');
{
if ((_tokenSet_3.member(LA(1))) && (_tokenSet_9.member(LA(2)))) {
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
}
else if ((_tokenSet_9.member(LA(1))) && ((LA(2) >= '\u0003' && LA(2) <= '~'))) {
}
else {
throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine());
}
}
{
switch ( LA(1)) {
case '"': case '#': case '\'': case '(':
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9': case ':': case 'A':
case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I':
case 'J': case 'K': case 'L': case 'M':
case 'N': case 'O': case 'P': case 'Q':
case 'R': case 'S': case 'T': case 'U':
case 'V': case 'W': case 'X': case 'Y':
case 'Z': case '[': case '_': case 'a':
case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i':
case 'j': case 'k': case 'l': case 'm':
case 'n': case 'o': case 'p': case 'q':
case 'r': case 's': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y':
case 'z':
{
mARG(false);
{
_loop39:
do {
if ((LA(1)==',')) {
match(',');
{
switch ( LA(1)) {
case '\t': case '\n': case '\r': case ' ':
{
_saveIndex=text.length();
mWS(false);
text.setLength(_saveIndex);
break;
}
case '"': case '#': case '\'': case '(':
case '0': case '1': case '2': case '3':
case '4': case '5': case '6': case '7':
case '8': case '9': case ':': case 'A':
case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I':
case 'J': case 'K': case 'L': case 'M':
case 'N': case 'O': case 'P': case 'Q':
case 'R': case 'S': case 'T': case 'U':
case 'V': case 'W': case 'X': case 'Y':
case 'Z': case '[': case '_': case 'a':
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -