代码搜索结果
找到约 10,000 项符合
G 的代码
expr.g
{
import java.io.*;
}
class ExprParser extends Parser;
options {
codeGenMakeSwitchThreshold = 3;
codeGenBitsetTestThreshold = 4;
buildAST=true;
ASTLabelType = "antlr.CommonAST"; // cha
test.g
{
import antlr.ASTFactory;
import antlr.collections.ASTEnumeration;
}
class SupportTest extends Parser;
options {
buildAST = true;
}
{
/** Test the equals, equalsSubtree, and findAll met
treewalk.g
class LangParser extends Parser;
options {
buildAST=true;
}
tokens {
BLOCK; // imaginary token
}
block
: LCURLY! ( statement )* RCURLY!
// add imaginary BLOCK node on top of statem
html.g
/*
Based on the HTML 3.2 spec. by the W3 (http://www.w3.org)
Alexander Hinds & Terence Parr
Magelang Institute, Ltd.
Send comments to: parrt@jguru.com
v1.2 Fixed a bug APARAM->APARM in APPLET
data.g
class DataParser extends Parser;
file: ( sh:SHORT {System.out.println(sh.getText());}
| st:STRING {System.out.println("\""+st.getText()+"\"");}
)+
;
class DataLexer extends Lexer;
options {
ch
calc.g
/** This example demonstrates the heterogeneous tree construction
* mechanism. Compare this example to examples/calc/calc.g
* to see that I use tree node methods not a tree walker to compute
*
instr.g
class InstrParser extends Parser;
options {
buildAST = true;
k=2;
}
tokens {
CALL; // define imaginary token CALL
}
slist
: ( stat )+
;
stat: LBRACE^ (stat)+ RBRACE
| "if"^ expr "then" stat (
java.g
/** Java 1.2 Recognizer
*
* Run 'java Main '
*
* Contributing authors:
* John Mitchell johnm@non.net
* Terence Parr parrt@magelang.com
* John Lilley jlilley
rewrite.g
class Rewrite extends Lexer;
protected
START
options {
ignore=WS;
}
: id:ID ":="! '('! expr:EXPR ')'!
{
// can access text matched for any rule
System.out.println("found "+id.getText()+","+
t.g
class T extends Lexer;
options {
k=2;
filter=IGNORE;
charVocabulary = '\3'..'\177';
}
P : "" ;
BR: "" ;
protected
IGNORE
: '')* '>' {System.out.println("invalid tag: "+