1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Trying desperately to get the Windows build working.

This commit is contained in:
David A. Mellis
2005-10-06 17:18:26 +00:00
parent 9e8cc277ea
commit 21fe7f0a83
30 changed files with 31826 additions and 32800 deletions

View File

@ -6,17 +6,17 @@ import java.util.*;
import antlr.CommonAST;
import antlr.DumpASTVisitor;
}
class WEmitter extends TreeParser;
options {
importVocab= W;
buildAST= false;
ASTLabelType= "TNode";
codeGenMakeSwitchThreshold= 2;
codeGenBitsetTestThreshold= 3;
}
}
class WEmitter extends TreeParser;
options {
importVocab= W;
buildAST= false;
ASTLabelType= "TNode";
codeGenMakeSwitchThreshold= 2;
codeGenBitsetTestThreshold= 3;
}
{
@ -359,29 +359,29 @@ void commaSep( TNode t ) {
}
translationUnit
options {
defaultErrorHandler=false;
}
}
translationUnit
options {
defaultErrorHandler=false;
}
:{ initializePrinting(); }
( externalList )?
{ finalizePrinting(); }
;
;
externalList :( externalDef )+
;
;
externalDef :declaration
| functionDef
| asm_expr
| typelessDeclaration
| s:SEMI { print( s ); }
;
;
typelessDeclaration :#(NTypeMissing initDeclList s: SEMI) { print( s ); }
;
;
asm_expr :#( a:"asm" { print( a ); }
( v:"volatile" { print( v ); }
)?
@ -390,8 +390,8 @@ asm_expr :#( a:"asm" { print( a ); }
rc:RCURLY { tabs--; print( rc ); }
s:SEMI { print( s ); }
)
;
;
declaration :#( NDeclaration
declSpecifiers
(
@ -399,29 +399,29 @@ declaration :#( NDeclaration
)?
( s:SEMI { print( s ); } )+
)
;
;
declSpecifiers :( storageClassSpecifier
| typeQualifier
| typeSpecifier
)+
;
;
storageClassSpecifier :a:"auto" { print( a ); }
| b:"register" { print( b ); }
| c:"typedef" { print( c ); }
| functionStorageClassSpecifier
;
;
functionStorageClassSpecifier :a:"extern" { print( a ); }
| b:"static" { print( b ); }
| c:"inline" { print( c ); }
;
;
typeQualifier :a:"const" { print( a ); }
| b:"volatile" { print( b ); }
;
;
typeSpecifier :a:"void" { print( a ); }
| b:"char" { print( b ); }
| c:"short" { print( c ); }
@ -446,21 +446,21 @@ typeSpecifier :a:"void" { print( a ); }
rp:RPAREN { print( rp ); }
)
| p:"__complex" { print( p ); }
;
;
typedefName :#(NTypedefName i:ID { print( i ); } )
;
;
structSpecifier :#( a:"struct" { print( a ); }
structOrUnionBody
)
;
;
unionSpecifier :#( a:"union" { print( a ); }
structOrUnionBody
)
;
;
structOrUnionBody :( (ID LCURLY) => i1:ID lc1:LCURLY { print( i1 ); print ( "{" ); tabs++; }
( structDeclarationList )?
rc1:RCURLY { tabs--; print( rc1 ); }
@ -469,32 +469,32 @@ structOrUnionBody :( (ID LCURLY) => i1:ID lc1:LCURLY { print( i1 ); print ( "{
rc2:RCURLY { tabs--; print( rc2 ); }
| i2:ID { print( i2 ); }
)
;
;
structDeclarationList :( structDeclaration { print( ";" ); }
)+
;
;
structDeclaration :specifierQualifierList structDeclaratorList
;
;
specifierQualifierList :(
typeSpecifier
| typeQualifier
)+
;
;
structDeclaratorList :structDeclarator
( { print(","); } structDeclarator )*
;
;
structDeclarator :#( NStructDeclarator
( declarator )?
( c:COLON { print( c ); } expr )?
( attributeDecl )*
)
;
;
enumSpecifier :#( a:"enum" { print( a ); }
( i:ID { print( i ); } )?
( lc:LCURLY { print( lc ); tabs++; }
@ -502,17 +502,17 @@ enumSpecifier :#( a:"enum" { print( a ); }
rc:RCURLY { tabs--; print( rc ); }
)?
)
;
;
enumList :enumerator ( {print(",");} enumerator)*
;
;
enumerator :i:ID { print( i ); }
( b:ASSIGN { print( b ); }
expr
)?
;
;
attributeDecl :#( a:"__attribute" { print( a ); }
(b:. { print( b ); } )*
)
@ -521,13 +521,13 @@ attributeDecl :#( a:"__attribute" { print( a ); }
expr { print( ")" ); }
rp:RPAREN { print( rp ); }
)
;
;
initDeclList :initDecl
( { print( "," ); } initDecl )*
;
initDecl { String declName = ""; }
;
initDecl { String declName = ""; }
:#(NInitDecl
declarator
( attributeDecl )*
@ -537,25 +537,25 @@ initDecl { String declName = ""; }
expr
)?
)
;
;
pointerGroup :#( NPointerGroup
( a:STAR { print( a ); }
( typeQualifier )*
)+
)
;
;
idList :i:ID { print( i ); }
( c:COMMA { print( c ); }
id:ID { print( id ); }
)*
;
;
initializer :#( NInitializer (initializerElementLabel)? expr )
| lcurlyInitializer
;
;
initializerElementLabel :#( NInitializerElementLabel
(
( l:LBRACKET { print( l ); }
@ -567,18 +567,18 @@ initializerElementLabel :#( NInitializerElementLabel
| d:DOT i2:ID a2:ASSIGN { print( d ); print( i2 ); print( a2 ); }
)
)
;
;
lcurlyInitializer :#(n:NLcurlyInitializer { print( n ); tabs++; }
initializerList
rc:RCURLY { tabs--; print( rc ); }
)
;
;
initializerList :( i:initializer { commaSep( i ); }
)*
;
;
declarator :#( NDeclarator
( pointerGroup )?
@ -596,22 +596,22 @@ declarator :#( NDeclarator
| lb:LBRACKET { print( lb );} ( expr )? rb:RBRACKET { print( rb ); }
)*
)
;
;
parameterTypeList :( parameterDeclaration
( c:COMMA { print( c ); }
| s:SEMI { print( s ); }
)?
)+
( v:VARARGS { print( v ); } )?
;
;
parameterDeclaration :#( NParameterDeclaration
declSpecifiers
(declarator | nonemptyAbstractDeclarator)?
)
;
;
functionDef :#( NFunctionDef
( functionDeclSpecifiers)?
declarator
@ -620,14 +620,14 @@ functionDef :#( NFunctionDef
)*
compoundStatement
)
;
;
functionDeclSpecifiers :( functionStorageClassSpecifier
| typeQualifier
| typeSpecifier
)+
;
;
declarationList :( //ANTLR doesn't know that declarationList properly eats all the declarations
//so it warns about the ambiguity
options {
@ -636,15 +636,15 @@ declarationList :( //ANTLR doesn't know that declarationList properly eats all
localLabelDecl
| declaration
)+
;
;
localLabelDecl :#(a:"__label__" { print( a ); }
( i:ID { commaSep( i ); }
)+
{ print( ";" ); }
)
;
;
compoundStatement :#( cs:NCompoundStatement { print( cs ); tabs++; }
( declarationList
| functionDef
@ -653,14 +653,14 @@ compoundStatement :#( cs:NCompoundStatement { print( cs ); tabs++
rc:RCURLY { tabs--; print( rc ); }
)
;
;
statementList :( statement )+
;
;
statement :statementBody
;
;
statementBody :s:SEMI { print( s ); }
| compoundStatement // Group of statements
@ -738,8 +738,8 @@ statementBody :s:SEMI { print( s ); }
;
;
expr :binaryExpr
| conditionalExpr
| castExpr
@ -751,20 +751,20 @@ expr :binaryExpr
| initializer
| rangeExpr
| gnuAsmExpr
;
;
emptyExpr :NEmptyExpression
;
;
compoundStatementExpr :#(l:LPAREN { print( l ); }
compoundStatement
r:RPAREN { print( r ); }
)
;
;
rangeExpr :#(NRangeExpr expr v:VARARGS{ print( v ); } expr)
;
;
gnuAsmExpr :#(n:NGnuAsmExpr { print( n ); }
(v:"volatile" { print( v ); } )?
lp:LPAREN { print( lp ); }
@ -789,16 +789,16 @@ gnuAsmExpr :#(n:NGnuAsmExpr { print( n ); }
)?
rp:RPAREN { print( rp ); }
)
;
;
strOptExprPair :stringConst
(
l:LPAREN { print( l ); }
expr
r:RPAREN { print( r ); }
)?
;
;
binaryOperator :ASSIGN
| DIV_ASSIGN
| PLUS_ASSIGN
@ -829,8 +829,8 @@ binaryOperator :ASSIGN
| DIV
| MOD
| NCommaExpr
;
;
binaryExpr :b:binaryOperator
// no rules allowed as roots, so here I manually get
// the first and second children of the binary operator
@ -843,27 +843,27 @@ binaryExpr :b:binaryOperator
expr( e2 );
}
;
;
conditionalExpr :#( q:QUESTION
expr { print( q ); }
( expr )?
c:COLON { print( c ); }
expr
)
;
;
castExpr :#(
c:NCast { print( c ); }
typeName
rp:RPAREN { print( rp ); }
expr
)
;
;
typeName :specifierQualifierList (nonemptyAbstractDeclarator)?
;
;
nonemptyAbstractDeclarator :#( NNonemptyAbstractDeclarator
( pointerGroup
( (lp1:LPAREN { print( lp1 ); }
@ -893,8 +893,8 @@ nonemptyAbstractDeclarator :#( NNonemptyAbstractDeclarator
)+
)
)
;
;
unaryExpr :#( i:INC { print( i ); } expr )
| #( d:DEC { print( d ); } expr )
| #( NUnaryExpr u:unaryOperator { print( u ); } expr)
@ -914,8 +914,8 @@ unaryExpr :#( i:INC { print( i ); } expr )
| expr
)
)
;
;
unaryOperator :BAND
| STAR
| PLUS
@ -925,8 +925,8 @@ unaryOperator :BAND
| LAND
| "__real"
| "__imag"
;
;
postfixExpr :#( NPostfixExpr
primaryExpr
( a:PTR b:ID { print( a ); print( b ); }
@ -942,8 +942,8 @@ postfixExpr :#( NPostfixExpr
| g:DEC { print( g ); }
)+
)
;
;
primaryExpr :i:ID { print( i ); }
| n:Number { print( n ); }
| charConst
@ -957,21 +957,21 @@ primaryExpr :i:ID { print( i ); }
| #( eg:NExpressionGroup { print( eg ); }
expr { print( ")" ); }
)
;
;
argExprList :expr ( {print( "," );} expr )*
;
;
protected charConst :c:CharLiteral { print( c ); }
;
;
protected stringConst :#( NStringSeq
(
s:StringLiteral { print( s ); }
)+
)
;
;
protected intConst :IntOctalConst
| LongOctalConst
| UnsignedOctalConst
@ -981,18 +981,18 @@ protected intConst :IntOctalConst
| IntHexConst
| LongHexConst
| UnsignedHexConst
;
;
protected floatConst :FloatDoubleConst
| DoubleDoubleConst
| LongDoubleConst
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
commaExpr :#(NCommaExpr expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
assignExpr :#( ASSIGN expr expr)
| #( DIV_ASSIGN expr expr)
| #( PLUS_ASSIGN expr expr)
@ -1004,54 +1004,54 @@ assignExpr :#( ASSIGN expr expr)
| #( BAND_ASSIGN expr expr)
| #( BOR_ASSIGN expr expr)
| #( BXOR_ASSIGN expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
logicalOrExpr :#( LOR expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
logicalAndExpr :#( LAND expr expr )
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
inclusiveOrExpr :#( BOR expr expr )
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
exclusiveOrExpr :#( BXOR expr expr )
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
bitAndExpr :#( BAND expr expr )
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
equalityExpr :#( EQUAL expr expr)
| #( NOT_EQUAL expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
relationalExpr :#( LT expr expr)
| #( LTE expr expr)
| #( GT expr expr)
| #( GTE expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
shiftExpr :#( LSHIFT expr expr)
| #( RSHIFT expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
additiveExpr :#( PLUS expr expr)
| #( MINUS expr expr)
;
// inherited from grammar WTreeParser
;
// inherited from grammar WTreeParser
multExpr :#( STAR expr expr)
| #( DIV expr expr)
| #( MOD expr expr)
;
;