Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F2730406
LispParser.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Mar 13, 11:03 PM
Size
4 KB
Mime Type
text/x-Algol68
Expires
Sun, Mar 15, 11:03 PM (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
243499
Attached To
rXR Xreate
LispParser.java
View Options
package
org.xreate.grammatic.lisp
;
// $ANTLR 3.4 /private/prg/code/xreate/antlr/lisp.g 2012-04-07 17:57:03
import
org.antlr.runtime.*
;
import
java.util.Stack
;
import
java.util.List
;
import
java.util.ArrayList
;
@SuppressWarnings
({
"all"
,
"warnings"
,
"unchecked"
})
public
class
LispParser
extends
Parser
{
public
static
final
String
[]
tokenNames
=
new
String
[]
{
"<invalid>"
,
"<EOR>"
,
"<DOWN>"
,
"<UP>"
,
"WHITESPACE"
,
"WORD"
,
"'('"
,
"')'"
,
"','"
};
public
static
final
int
EOF
=-
1
;
public
static
final
int
T__6
=
6
;
public
static
final
int
T__7
=
7
;
public
static
final
int
T__8
=
8
;
public
static
final
int
WHITESPACE
=
4
;
public
static
final
int
WORD
=
5
;
// delegates
public
Parser
[]
getDelegates
()
{
return
new
Parser
[]
{};
}
// delegators
public
LispParser
(
TokenStream
input
)
{
this
(
input
,
new
RecognizerSharedState
());
}
public
LispParser
(
TokenStream
input
,
RecognizerSharedState
state
)
{
super
(
input
,
state
);
}
public
String
[]
getTokenNames
()
{
return
LispParser
.
tokenNames
;
}
public
String
getGrammarFileName
()
{
return
"/private/prg/code/xreate/antlr/lisp.g"
;
}
// $ANTLR start "statement"
// /private/prg/code/xreate/antlr/lisp.g:7:1: statement : WORD ( '(' statement ( ',' statement )* ')' )? ;
public
final
ASTLispNode
statement
(
ASTLispNode
node
)
throws
RecognitionException
{
try
{
// /private/prg/code/xreate/antlr/lisp.g:8:2: ( WORD ( '(' statement ( ',' statement )* ')' )? )
// /private/prg/code/xreate/antlr/lisp.g:8:4: WORD ( '(' statement ( ',' statement )* ')' )?
{
CommonToken
token
=
(
CommonToken
)
match
(
input
,
WORD
,
FOLLOW_WORD_in_statement71
);
String
text
=
token
.
getText
();
ASTLispNode
nodeChild
=
(
'0'
<=
text
.
charAt
(
0
)
&&
'9'
>=
text
.
charAt
(
0
))?
new
ASTLispConstantNode
(
text
)
:
new
ASTLispNode
(
text
);
if
(
node
!=
null
){
node
.
add
(
nodeChild
);
}
node
=
nodeChild
;
// /private/prg/code/xreate/antlr/lisp.g:8:9: ( '(' statement ( ',' statement )* ')' )?
int
alt2
=
2
;
int
LA2_0
=
input
.
LA
(
1
);
if
(
(
LA2_0
==
6
)
)
{
alt2
=
1
;
}
switch
(
alt2
)
{
case
1
:
// /private/prg/code/xreate/antlr/lisp.g:8:10: '(' statement ( ',' statement )* ')'
{
match
(
input
,
6
,
FOLLOW_6_in_statement74
);
pushFollow
(
FOLLOW_statement_in_statement76
);
statement
(
node
);
state
.
_fsp
--;
// /private/prg/code/xreate/antlr/lisp.g:8:24: ( ',' statement )*
loop1:
do
{
int
alt1
=
2
;
int
LA1_0
=
input
.
LA
(
1
);
if
(
(
LA1_0
==
8
)
)
{
alt1
=
1
;
}
switch
(
alt1
)
{
case
1
:
// /private/prg/code/xreate/antlr/lisp.g:8:25: ',' statement
{
match
(
input
,
8
,
FOLLOW_8_in_statement79
);
pushFollow
(
FOLLOW_statement_in_statement81
);
statement
(
node
);
state
.
_fsp
--;
}
break
;
default
:
break
loop1
;
}
}
while
(
true
);
match
(
input
,
7
,
FOLLOW_7_in_statement85
);
}
break
;
}
}
}
catch
(
RecognitionException
re
)
{
reportError
(
re
);
recover
(
input
,
re
);
}
finally
{
// do for sure before leaving
}
return
node
;
}
// $ANTLR end "statement"
// Delegated rules
public
static
final
BitSet
FOLLOW_WORD_in_statement71
=
new
BitSet
(
new
long
[]{
0x0000000000000042L
});
public
static
final
BitSet
FOLLOW_6_in_statement74
=
new
BitSet
(
new
long
[]{
0x0000000000000020L
});
public
static
final
BitSet
FOLLOW_statement_in_statement76
=
new
BitSet
(
new
long
[]{
0x0000000000000180L
});
public
static
final
BitSet
FOLLOW_8_in_statement79
=
new
BitSet
(
new
long
[]{
0x0000000000000020L
});
public
static
final
BitSet
FOLLOW_statement_in_statement81
=
new
BitSet
(
new
long
[]{
0x0000000000000180L
});
public
static
final
BitSet
FOLLOW_7_in_statement85
=
new
BitSet
(
new
long
[]{
0x0000000000000002L
});
}
Event Timeline
Log In to Comment