build: Add lexer/parser.cs files to src ctrl
Move all lexer/parser files into a single dir, DataStreamGrammar, for organizational purposes and to avoid dependency conflicts when generating code. Note that we'll only need to regen cs if we modify the parser/lexer files, which seems unlikely.
This commit is contained in:
1 parent
86a1695286
commit
cc2959249e
18 files changed
+13590
-56
No files matched your search
@@ -1,15 +0,0 @@
|
||||
%parser ArithmeticTokens.lexer
|
||||
%namespace BCG.ArithmeticExpression
|
||||
|
||||
%left Plus Minus
|
||||
%left Times Div
|
||||
%before Minus
|
||||
%nonassoc Equals
|
||||
|
||||
BindingExpression: BindingExpression Assignment | Assignment;
|
||||
Assignment: Identifier Equals Expression;
|
||||
Expression : Expression Plus Term | Expression Minus Term | Term;
|
||||
Term : Term Times Factor | Term Div Factor | Factor;
|
||||
Factor : Application | Identifier | IntegerConstant | RealConstant | Minus Factor | OpenP Expression CloseP;
|
||||
Application : Identifier OpenP ExpressionList CloseP;
|
||||
ExpressionList : | ExpressionList Comma Expression | Expression;
|
||||
@@ -1,43 +0,0 @@
|
||||
%lexer
|
||||
%namespace BCG.ArithmeticExpression
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Literal constants
|
||||
//--------------------------------------------------------------------------------
|
||||
%define TimeConstant [012]?{Digit}:[0-5]{Digit}:[0-5]{Digit}[ ]('AM'|'PM')
|
||||
%define DateConstant ([1-9]|'10'|'11'|'12')\/([1-9]|([1-2][0-9])|'30'|'31')\/{Digit}{Digit}{Digit}*
|
||||
|
||||
%token NumberConstant {
|
||||
public object value;
|
||||
}
|
||||
%token IntegerConstant : NumberConstant {}
|
||||
%token RealConstant : NumberConstant {}
|
||||
|
||||
|
||||
-?{Digit}+ %IntegerConstant {value = Int32.Parse(yytext);}
|
||||
-?{Digit}+\.{Digit}+ %RealConstant {value = Double.Parse(yytext);}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Identifiers
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
{Letter}({Letter}*{Digit}*_*)* %Identifier
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
// Utility tokens
|
||||
// --------------------------------------------------------------------------------
|
||||
|
||||
"(" %OpenP
|
||||
")" %CloseP
|
||||
"-" %Minus
|
||||
"*" %Times
|
||||
"/" %Div
|
||||
"," %Comma
|
||||
"+" %Plus
|
||||
"=" %Equals
|
||||
'\/\/'[^\n\r]* ;
|
||||
[ \t\r\n] ;
|
||||
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
%parser BooleanExpressionTokens.lexer
|
||||
%namespace BCG.Evaluator.ColumnMapExpression
|
||||
|
||||
%symbol ColumnMapExpression {
|
||||
public ColumnMapExpression (System.Collections.IDictionary tcolumns, bool tisInclusive)
|
||||
{
|
||||
columns = tcolumns;
|
||||
isInclusive = tisInclusive;
|
||||
}
|
||||
public ColumnMapExpression (bool tisInclusive)
|
||||
{
|
||||
columns = new System.Collections.Hashtable();
|
||||
isInclusive = tisInclusive;
|
||||
}
|
||||
public System.Collections.IDictionary columns;
|
||||
public bool isInclusive;
|
||||
}
|
||||
|
||||
%symbol AliasList {
|
||||
public AliasList (string name, string newName, AliasList oldList)
|
||||
{
|
||||
columns = oldList.columns;
|
||||
columns [name] = newName;
|
||||
}
|
||||
public AliasList (string name, string newName)
|
||||
{
|
||||
columns = new System.Collections.Hashtable();
|
||||
columns [name] = newName;
|
||||
}
|
||||
public AliasList (string name)
|
||||
{
|
||||
columns = new System.Collections.Hashtable();
|
||||
columns [name] = name;
|
||||
}
|
||||
public AliasList (string name, AliasList oldList)
|
||||
{
|
||||
columns = oldList.columns;
|
||||
columns [name] = name;
|
||||
}
|
||||
|
||||
public System.Collections.IDictionary columns;
|
||||
}
|
||||
|
||||
ColumnMapExpression : Not AliasList:al %ColumnMapExpression(al.columns,false)
|
||||
| Not %ColumnMapExpression(false)
|
||||
| AliasList:al %ColumnMapExpression(al.columns,true)
|
||||
;
|
||||
|
||||
AliasList : Identifier:old MapsTo Identifier:new %AliasList (old.yytext,new.yytext)
|
||||
| Identifier:old MapsTo Identifier:new AliasList:rest %AliasList (old.yytext,new.yytext, rest)
|
||||
| Identifier:c %AliasList (c.yytext)
|
||||
| Identifier:c AliasList:rest %AliasList (c.yytext,rest)
|
||||
;
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Lexer Include="ArithmeticTokens.lexer" />
|
||||
<Compile Include="$(DataStreamGrammarDir)\ArithmeticTokens.lexer.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Parser Include="ArithmeticSyntax.parser" />
|
||||
<Parser Include="ColumnMapExpressionSyntax.parser" />
|
||||
<Compile Include="$(DataStreamGrammarDir)\ArithmeticSyntax.parser.cs" />
|
||||
<Compile Include="$(DataStreamGrammarDir)\ColumnMapExpressionSyntax.parser.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in new issue
Block a user