[svn-commits] murf: branch murf/fast-ast r41229 - /team/murf/fast-ast/main/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Aug 28 08:08:44 MST 2006


Author: murf
Date: Mon Aug 28 10:08:43 2006
New Revision: 41229

URL: http://svn.digium.com/view/asterisk?rev=41229&view=rev
Log:
more notes -- combining the grammars.
nothing's even near finished yet.


Added:
    team/murf/fast-ast/main/ast_var.fl   (with props)
Modified:
    team/murf/fast-ast/main/ast_var.y

Added: team/murf/fast-ast/main/ast_var.fl
URL: http://svn.digium.com/view/asterisk/team/murf/fast-ast/main/ast_var.fl?rev=41229&view=auto
==============================================================================
--- team/murf/fast-ast/main/ast_var.fl (added)
+++ team/murf/fast-ast/main/ast_var.fl Mon Aug 28 10:08:43 2006
@@ -1,0 +1,47 @@
+/* 
+%left <part> Name Num Stringconst
+*/
+
+%x comment
+%%
+	int line_num = 1;
+
+"/*"         BEGIN(comment);
+
+<comment>[^*\n]*
+<comment>[^*\n]*\n      ++line_num;
+<comment>"*"+[^*/\n]*
+<comment>"*"+[^*/\n]*\n ++line_num;
+<comment>"*/"        BEGIN(INITIAL);
+
+\?			{ return TOK_COND; }
+\:\:		{ return TOK_COLONCOLON; }
+\:		{ return TOK_COLON; }
+\|		{ return TOK_OR; }
+\&		{ return TOK_AND; }
+\=		{ return TOK_EQ; }
+\>		{ return TOK_GT; }
+\<		{ return TOK_LT; }
+\>\=		{ return TOK_GE; }
+\<\=		{ return TOK_LE; }
+!=		{ return TOK_NE; }
+\+		{ return TOK_PLUS; }
+\-		{ return TOK_MINUS; }
+\*		{ return TOK_MULT; }
+\/		{ return TOK_DIV; }
+\%		{ return TOK_MOD; }
+\~		{ return TOK_COMPL; }
+\=\~		{ return TOK_EQTILDE; }
+\(		{ return TOK_LP; }
+\)		{ return TOK_RP; }
+\$\{		{ return TOK_BEGIN_VARREF; }
+\$\[		{ return TOK_BEGIN_EXPRESSION; }
+\{		{ return TOK_LCURLY; }
+\}		{ return TOK_RCURLY; }
+\,		{ return TOK_COMMA; }
+\[		{ return TOK_LBRACK; }
+\]		{ return TOK_RBRACK; }
+
+
+
+%%

Propchange: team/murf/fast-ast/main/ast_var.fl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/murf/fast-ast/main/ast_var.fl
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: team/murf/fast-ast/main/ast_var.fl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/murf/fast-ast/main/ast_var.y
URL: http://svn.digium.com/view/asterisk/team/murf/fast-ast/main/ast_var.y?rev=41229&r1=41228&r2=41229&view=diff
==============================================================================
--- team/murf/fast-ast/main/ast_var.y (original)
+++ team/murf/fast-ast/main/ast_var.y Mon Aug 28 10:08:43 2006
@@ -27,7 +27,29 @@
 	PART_FUNC = 2,
 	PART_VARNAME = 3,
 	PART_SUBSTR = 4,
-	PART_STR = 5
+	PART_STR = 5,
+	PART_EXPRESSION = 6,
+	PART_OP_PARENS =7,
+	PART_OP_OR = 8,
+	PART_OP_AND = 9,
+	PART_OP_EQ = 10,
+	PART_OP_GT = 11,
+	PART_OP_LT = 12,
+	PART_OP_GE = 13,
+	PART_OP_LE = 14,
+	PART_OP_NE = 15,
+	PART_OP_PLUS = 16,
+	PART_OP_MINUS = 17,
+	PART_OP_NEGATE = 18,
+	PART_OP_COMPL = 19,
+	PART_OP_MULT = 20,
+	PART_OP_DIV = 21,
+	PART_OP_MOD = 22,
+	PART_OP_COLON = 23,
+	PART_OP_EQTILDE = 24,
+	PART_OP_CONDEXPR = 25,
+	PART_NAME = 26,
+	PART_NUM = 27
 };
 
 
@@ -62,19 +84,23 @@
 		struct part *ref;
 		char *string;
 		int offset;
+		struct part *expr;
+		double number;
 	} u1;
 
 	union 
 	{
 		struct part *substr;
 		struct part *arglist;
+		struct part *expr;
 		int length;
 	} u2;
 
 	union 
 	{
 		struct part *substr;
-	} u2;
+		struct part *expr;
+	} u3;
 	
 	struct part *next; /* to next arg */
 };
@@ -91,17 +117,17 @@
 	 
 
 
-%left <part> TOK_COND TOK_COLONCOLON
-%left <part> TOK_OR
-%left <part> TOK_AND
-%left <part> TOK_EQ TOK_GT TOK_LT TOK_GE TOK_LE TOK_NE
-%left <part> TOK_PLUS TOK_MINUS
-%left <part> TOK_MULT TOK_DIV TOK_MOD
-%right <part> TOK_COMPL
-%left <part> TOK_COLON TOK_EQTILDE
-%left <part> TOK_RP TOK_LP
-
-%left <part> TOK_DOLL TOK_LCURLY TOK_RCURLY  TOK_COMMA TOK_LBRACK TOK_RBRACK
+%left TOK_COND TOK_COLONCOLON
+%left TOK_OR
+%left TOK_AND
+%left TOK_EQ TOK_GT TOK_LT TOK_GE TOK_LE TOK_NE
+%left TOK_PLUS TOK_MINUS
+%left TOK_MULT TOK_DIV TOK_MOD
+%right TOK_COMPL
+%left TOK_COLON TOK_EQTILDE
+%left TOK_RP TOK_LP
+
+%left BEGIN_VARREF BEGIN_EXPRESSION TOK_RCURLY TOK_LCURLY  TOK_COMMA TOK_LBRACK TOK_RBRACK
 %left <part> Name Num Stringconst
 
 %type <part> varref thing substr args arg expression expr
@@ -121,10 +147,10 @@
            ;
 
 
-varref : TOK_DOLL TOK_LCURLY  thing TOK_RCURLY {}
+varref : BEGIN_VARREF TOK_LCURLY  thing TOK_RCURLY {}
        ;
 
-expression : TOK_DOLL TOK_LBRACK expr TOK_RBRACK {}
+expression : BEGIN_EXPRESSION TOK_LBRACK expr TOK_RBRACK {}
            ;
 
 
@@ -144,38 +170,38 @@
      | args TOK_COMMA arg { $$=$1; $$->next = $3;}
 	 ;
 
-arg : Name {$$=new_part(PART_STR); $$->u1.string=$1;}
-    | Num {char numbuf[40]; $$=new_part(PART_STR); sprintf(numbuf,"%d",$1); $$->u1.string=strdup(numbuf);}
+arg : Name {$$=new_part(PART_NAME); $$->u1.string=$1;}
+    | Num {$$=new_part(PART_NUM); $$->u1.number = $1;}
 	| varref {$$=$1;}
     | expression { $$ = $1;  }
     ;
 
 
-expr:	Stringconst  { $$= $1;}
-    | Num {  }
-    | Name {  }
-    | varref {  }
-    | expression {  }
-
-	| TOK_LP expr TOK_RP {  }
-	| expr TOK_OR expr { }
-	| expr TOK_AND expr { }
-	| expr TOK_EQ expr { }
-	| expr TOK_GT expr { }
-	| expr TOK_LT expr { }
-	| expr TOK_GE expr  { }
-	| expr TOK_LE expr  { }
-	| expr TOK_NE expr  { }
-	| expr TOK_PLUS expr { }
-	| expr TOK_MINUS expr { }
-	| TOK_MINUS expr %prec TOK_COMPL { }
-	| TOK_COMPL expr   { }
-	| expr TOK_MULT expr { }
-	| expr TOK_DIV expr { }
-	| expr TOK_MOD expr { }
-	| expr TOK_COLON expr { }
-	| expr TOK_EQTILDE expr { }
-	| expr TOK_COND expr TOK_COLONCOLON expr  { }
+expr:	Stringconst  { $$=new_part(PART_STR); $$->u1.string=$1;}
+    | Num { $$=new_part(PART_NUM); $$->u1.number = $1; }
+    | Name { $$=new_part(PART_NAME); $$->u1.string=$1; }
+	| varref { $$=$1;  }
+    | expression { $$=$1; }
+
+	| TOK_LP expr TOK_RP { $$=new_part(PART_OP_PARENS); $$->u1.expr=$2; }
+	| expr TOK_OR expr { $$=new_part(PART_OP_OR); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_AND expr { $$=new_part(PART_OP_AND); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_EQ expr { $$=new_part(PART_OP_EQ); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_GT expr { $$=new_part(PART_OP_GT); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_LT expr { $$=new_part(PART_OP_LT); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_GE expr  { $$=new_part(PART_OP_GE); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_LE expr  { $$=new_part(PART_OP_LE); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_NE expr  { $$=new_part(PART_OP_NE); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_PLUS expr { $$=new_part(PART_OP_PLUS); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_MINUS expr { $$=new_part(PART_OP_MINUS); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| TOK_MINUS expr %prec TOK_COMPL { $$=new_part(PART_OP_NEGATE); $$->u1.expr=$2; }
+	| TOK_COMPL expr   { $$=new_part(PART_OP_COMP); $$->u1.expr=$2; }
+	| expr TOK_MULT expr { $$=new_part(PART_OP_MULT); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_DIV expr { $$=new_part(PART_OP_DIV); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_MOD expr { $$=new_part(PART_OP_MOD); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_COLON expr { $$=new_part(PART_OP_COLON); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_EQTILDE expr { $$=new_part(PART_OP_EQTILDE); $$->u1.expr=$1; $$->u2.expr = $3;}
+	| expr TOK_COND expr TOK_COLONCOLON expr  { $$=new_part(PART_OP_CONDEXPR); $$->u1.expr=$1; $$->u2.expr = $3; $$->u3.expr = $5;}
 	;
 
 



More information about the svn-commits mailing list