diff options
Diffstat (limited to '')
-rwxr-xr-x | build.sh | 12 | ||||
-rw-r--r-- | src/build.l | 18 | ||||
-rw-r--r-- | src/build.y | 74 |
3 files changed, 54 insertions, 50 deletions
@@ -1,7 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | BUSRC="stack.cpp string.cpp hash.cpp list.cpp trace.cpp stream.cpp formatter.cpp util.cpp sharedcore.cpp exceptionbase.cpp heap.cpp archivebase.cpp archive.cpp queue.cpp archival.cpp sio.cpp stdstream.cpp process.cpp plugger.cpp optparser.cpp signals.cpp array.cpp membuf.cpp file.cpp regex.cpp variant.cpp" | 3 | BUSRC="stack.cpp string.cpp hash.cpp list.cpp trace.cpp stream.cpp formatter.cpp util.cpp sharedcore.cpp exceptionbase.cpp heap.cpp archivebase.cpp archive.cpp queue.cpp archival.cpp sio.cpp stdstream.cpp process.cpp plugger.cpp optparser.cpp signals.cpp array.cpp membuf.cpp file.cpp variant.cpp" |
4 | BUHDR="stack.h string.h hash.h list.h trace.h stream.h formatter.h util.h sharedcore.h exceptionbase.h heap.h archivebase.h archive.h queue.h archival.h sio.h stdstream.h process.h config.h compat/linux.h compat/win32.h compat/osx.h plugger.h singleton.h optparser.h array.h membuf.h file.h regex.h variant.h fmt.h extratypes.h" | 4 | BUHDR="stack.h string.h hash.h list.h trace.h stream.h formatter.h util.h sharedcore.h exceptionbase.h heap.h archivebase.h archive.h queue.h archival.h sio.h stdstream.h process.h plugger.h singleton.h optparser.h array.h membuf.h file.h variant.h fmt.h extratypes.h" |
5 | BUCOMPAT="config.h compat/linux.h compat/win32.h compat/osx.h" | ||
5 | 6 | ||
6 | function bld() | 7 | function bld() |
7 | { | 8 | { |
@@ -27,7 +28,7 @@ function cmd() | |||
27 | 28 | ||
28 | function gpp() | 29 | function gpp() |
29 | { | 30 | { |
30 | bld "$1" "$2" || cmd CXX "$1" g++ -ggdb -fPIC -rdynamic -W -Wall -Iminibu -c -o "$1" "$2" | 31 | bld "$1" "$2" || cmd CXX "$1" g++ -ggdb -fPIC -W -Wall -Iminibu -c -o "$1" "$2" |
31 | } | 32 | } |
32 | 33 | ||
33 | if [ ! -z "$1" ]; then | 34 | if [ ! -z "$1" ]; then |
@@ -52,9 +53,12 @@ for file in $(cd bootstrap; ls); do | |||
52 | cmd BOOTSTRAP minibu/bu/${file} cp bootstrap/${file} minibu/bu | 53 | cmd BOOTSTRAP minibu/bu/${file} cp bootstrap/${file} minibu/bu |
53 | done | 54 | done |
54 | for F in $BUSRC; do | 55 | for F in $BUSRC; do |
55 | bld minibu/src/$F || cmd WGET minibu/src/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/src/$F | 56 | bld minibu/src/$F || cmd WGET minibu/src/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/stable/$F -O minibu/src/$F |
56 | done | 57 | done |
57 | for F in $BUHDR; do | 58 | for F in $BUHDR; do |
59 | bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/stable/$F -O minibu/bu/$F | ||
60 | done | ||
61 | for F in $BUCOMPAT; do | ||
58 | bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/bu/$F | 62 | bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/bu/$F |
59 | done | 63 | done |
60 | 64 | ||
diff --git a/src/build.l b/src/build.l index 7b770f7..30c79a6 100644 --- a/src/build.l +++ b/src/build.l | |||
@@ -118,36 +118,36 @@ int iStrDepth = 0; | |||
118 | 118 | ||
119 | "true" { | 119 | "true" { |
120 | yylval->bVal = true; | 120 | yylval->bVal = true; |
121 | return BOOL; | 121 | return LTR_BOOL; |
122 | } | 122 | } |
123 | "false" { | 123 | "false" { |
124 | yylval->bVal = false; | 124 | yylval->bVal = false; |
125 | return BOOL; | 125 | return LTR_BOOL; |
126 | } | 126 | } |
127 | 127 | ||
128 | [a-zA-Z_][a-zA-Z0-9_]*: { | 128 | [a-zA-Z_][a-zA-Z0-9_]*: { |
129 | yytext[yyleng-1] = '\0'; | 129 | yytext[yyleng-1] = '\0'; |
130 | yylval->sVal = rstrdup( yytext ); | 130 | yylval->sVal = rstrdup( yytext ); |
131 | return PROFILE; | 131 | return LTR_PROFILE; |
132 | } | 132 | } |
133 | 133 | ||
134 | [a-zA-Z_][a-zA-Z0-9_]* { | 134 | [a-zA-Z_][a-zA-Z0-9_]* { |
135 | yylval->sVal = rstrdup( yytext ); | 135 | yylval->sVal = rstrdup( yytext ); |
136 | if( b.isKeyword( yylval->sVal ) ) | 136 | if( b.isKeyword( yylval->sVal ) ) |
137 | return KEYWORD; | 137 | return LTR_KEYWORD; |
138 | else if( b.isCond( yylval->sVal ) ) | 138 | else if( b.isCond( yylval->sVal ) ) |
139 | return CONDITION; | 139 | return LTR_CONDITION; |
140 | return UNDEF; | 140 | return LTR_UNDEF; |
141 | } | 141 | } |
142 | 142 | ||
143 | -?([1-9][0-9]*)|(0) { | 143 | -?([1-9][0-9]*)|(0) { |
144 | yylval->iVal = strtol( yytext, NULL, 10 ); | 144 | yylval->iVal = strtol( yytext, NULL, 10 ); |
145 | return INT; | 145 | return LTR_INT; |
146 | } | 146 | } |
147 | 147 | ||
148 | (0\.0+)|(-?(([1-9][0-9]*)|(0))\.[0-9]*) { | 148 | (0\.0+)|(-?(([1-9][0-9]*)|(0))\.[0-9]*) { |
149 | yylval->fVal = strtof( yytext, NULL ); | 149 | yylval->fVal = strtof( yytext, NULL ); |
150 | return FLOAT; | 150 | return LTR_FLOAT; |
151 | } | 151 | } |
152 | 152 | ||
153 | \" { | 153 | \" { |
@@ -198,7 +198,7 @@ int iStrDepth = 0; | |||
198 | { | 198 | { |
199 | BEGIN( INITIAL ); | 199 | BEGIN( INITIAL ); |
200 | yylval->sVal = fstrdup( sBuf ); | 200 | yylval->sVal = fstrdup( sBuf ); |
201 | return STRING; | 201 | return LTR_STRING; |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
diff --git a/src/build.y b/src/build.y index 5a5e938..ae8a696 100644 --- a/src/build.y +++ b/src/build.y | |||
@@ -25,16 +25,16 @@ void yyerror( YYLTYPE *locp, yyscan_t yyscanner, BuildParser &bld, const char *m | |||
25 | bool bVal; | 25 | bool bVal; |
26 | } | 26 | } |
27 | 27 | ||
28 | %token <sVal> STRING "string literal" | 28 | %token <sVal> LTR_STRING "string literal" |
29 | %token <sVal> KEYWORD "keyword" | 29 | %token <sVal> LTR_KEYWORD "keyword" |
30 | %token <sVal> CONDITION "condition term" | 30 | %token <sVal> LTR_CONDITION "condition term" |
31 | %token <sVal> VARIABLE "variable name" | 31 | %token <sVal> LTR_VARIABLE "variable name" |
32 | %token <sVal> FUNCTION "function name" | 32 | %token <sVal> LTR_FUNCTION "function name" |
33 | %token <sVal> UNDEF "undefined identifier" | 33 | %token <sVal> LTR_UNDEF "undefined identifier" |
34 | %token <sVal> PROFILE "profile execute" | 34 | %token <sVal> LTR_PROFILE "profile execute" |
35 | %token <iVal> INT "integer literal" | 35 | %token <iVal> LTR_INT "integer literal" |
36 | %token <fVal> FLOAT "floating point literal" | 36 | %token <fVal> LTR_FLOAT "floating point literal" |
37 | %token <bVal> BOOL "boolean literal" | 37 | %token <bVal> LTR_BOOL "boolean literal" |
38 | 38 | ||
39 | %token TOK_TARGET "target" | 39 | %token TOK_TARGET "target" |
40 | %token TOK_INPUT "input" | 40 | %token TOK_INPUT "input" |
@@ -96,13 +96,13 @@ void yyerror( YYLTYPE *locp, yyscan_t yyscanner, BuildParser &bld, const char *m | |||
96 | %left '(' ')' '{' '}' '[' ']' | 96 | %left '(' ')' '{' '}' '[' ']' |
97 | %left IINEG IINOT | 97 | %left IINEG IINOT |
98 | 98 | ||
99 | %destructor { delete[] $$; } STRING | 99 | %destructor { delete[] $$; } LTR_STRING |
100 | %destructor { delete[] $$; } KEYWORD | 100 | %destructor { delete[] $$; } LTR_KEYWORD |
101 | %destructor { delete[] $$; } CONDITION | 101 | %destructor { delete[] $$; } LTR_CONDITION |
102 | %destructor { delete[] $$; } VARIABLE | 102 | %destructor { delete[] $$; } LTR_VARIABLE |
103 | %destructor { delete[] $$; } FUNCTION | 103 | %destructor { delete[] $$; } LTR_FUNCTION |
104 | %destructor { delete[] $$; } UNDEF | 104 | %destructor { delete[] $$; } LTR_UNDEF |
105 | %destructor { delete[] $$; } PROFILE | 105 | %destructor { delete[] $$; } LTR_PROFILE |
106 | 106 | ||
107 | %% /* Grammar rules */ | 107 | %% /* Grammar rules */ |
108 | 108 | ||
@@ -140,23 +140,23 @@ root_sub_exprs: | |||
140 | | root export | 140 | | root export |
141 | ; | 141 | ; |
142 | 142 | ||
143 | include: TOK_INCLUDE STRING ';' { bld.include( $2, yyscanner, &yylloc ); } | 143 | include: TOK_INCLUDE LTR_STRING ';' { bld.include( $2, yyscanner, &yylloc ); } |
144 | ; | 144 | ; |
145 | 145 | ||
146 | /* | 146 | /* |
147 | * data related | 147 | * data related |
148 | */ | 148 | */ |
149 | 149 | ||
150 | string: STRING { bld.xAst.addNode( @1, AstNode::typeString, $1 ); } | 150 | string: LTR_STRING { bld.xAst.addNode( @1, AstNode::typeString, $1 ); } |
151 | ; | 151 | ; |
152 | 152 | ||
153 | int: INT { bld.xAst.addNode( @1, AstNode::typeInt, $1 ); } | 153 | int: LTR_INT { bld.xAst.addNode( @1, AstNode::typeInt, $1 ); } |
154 | ; | 154 | ; |
155 | 155 | ||
156 | float: FLOAT { bld.xAst.addNode( @1, AstNode::typeFloat, $1 ); } | 156 | float: LTR_FLOAT { bld.xAst.addNode( @1, AstNode::typeFloat, $1 ); } |
157 | ; | 157 | ; |
158 | 158 | ||
159 | bool: BOOL { bld.xAst.addNode( @1, AstNode::typeBool, (bool)$1 ); } | 159 | bool: LTR_BOOL { bld.xAst.addNode( @1, AstNode::typeBool, (bool)$1 ); } |
160 | ; | 160 | ; |
161 | 161 | ||
162 | null: TOK_NULL { bld.xAst.addNode( @1, AstNode::typeNull ); } | 162 | null: TOK_NULL { bld.xAst.addNode( @1, AstNode::typeNull ); } |
@@ -168,7 +168,7 @@ literal: string | |||
168 | | null | 168 | | null |
169 | ; | 169 | ; |
170 | 170 | ||
171 | variable: UNDEF { bld.xAst.addNode( @1, AstNode::typeVariable, $1 ); } | 171 | variable: LTR_UNDEF { bld.xAst.addNode( @1, AstNode::typeVariable, $1 ); } |
172 | 172 | ||
173 | list_core: | 173 | list_core: |
174 | | { bld.xAst.openBranch(); } expr | 174 | | { bld.xAst.openBranch(); } expr |
@@ -199,9 +199,9 @@ value: value_core value_mods | |||
199 | * misc global things | 199 | * misc global things |
200 | */ | 200 | */ |
201 | 201 | ||
202 | notify: TOK_ERROR STRING ';' { bld.xAst.addNode( @$,AstNode::typeError, $2 ); } | 202 | notify: TOK_ERROR LTR_STRING ';' { bld.xAst.addNode( @$,AstNode::typeError, $2 ); } |
203 | | TOK_WARNING STRING ';' { bld.xAst.addNode( @$, AstNode::typeWarning, $2 ); } | 203 | | TOK_WARNING LTR_STRING ';' { bld.xAst.addNode( @$, AstNode::typeWarning, $2 ); } |
204 | | TOK_NOTICE STRING ';' { bld.xAst.addNode( @$, AstNode::typeNotice, $2 ); } | 204 | | TOK_NOTICE LTR_STRING ';' { bld.xAst.addNode( @$, AstNode::typeNotice, $2 ); } |
205 | ; | 205 | ; |
206 | /* | 206 | /* |
207 | set_rhs: '=' { bld.xAst.addNode( AstNode::typeOpEq ); } value | 207 | set_rhs: '=' { bld.xAst.addNode( AstNode::typeOpEq ); } value |
@@ -245,7 +245,7 @@ func_param_list: { bld.xAst.openBranch(); } expr | |||
245 | | func_param_list ',' { bld.xAst.openBranch(); } expr | 245 | | func_param_list ',' { bld.xAst.openBranch(); } expr |
246 | ; | 246 | ; |
247 | 247 | ||
248 | function: UNDEF '(' { | 248 | function: LTR_UNDEF '(' { |
249 | bld.xAst.addNode( @$, AstNode::typeFunction ); | 249 | bld.xAst.addNode( @$, AstNode::typeFunction ); |
250 | bld.xAst.openBranch(); | 250 | bld.xAst.openBranch(); |
251 | bld.xAst.addNode( @$, AstNode::typeString, $1 ); | 251 | bld.xAst.addNode( @$, AstNode::typeString, $1 ); |
@@ -254,7 +254,7 @@ function: UNDEF '(' { | |||
254 | } | 254 | } |
255 | ; | 255 | ; |
256 | 256 | ||
257 | function_no_input: UNDEF '(' { | 257 | function_no_input: LTR_UNDEF '(' { |
258 | bld.xAst.addNode( @$, AstNode::typeNull ); | 258 | bld.xAst.addNode( @$, AstNode::typeNull ); |
259 | bld.xAst.addNode( @$, AstNode::typeFunction ); | 259 | bld.xAst.addNode( @$, AstNode::typeFunction ); |
260 | bld.xAst.openBranch(); | 260 | bld.xAst.openBranch(); |
@@ -285,17 +285,17 @@ type: TOK_STRING { bld.xAst.addNode( @1, AstNode::typeTypeString ); } | |||
285 | 285 | ||
286 | expr: value | 286 | expr: value |
287 | | '(' expr ')' | 287 | | '(' expr ')' |
288 | | UNDEF '=' { | 288 | | LTR_UNDEF '=' { |
289 | bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); | 289 | bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); |
290 | } expr { | 290 | } expr { |
291 | bld.xAst.addNode( @3, AstNode::typeOpEq ); | 291 | bld.xAst.addNode( @3, AstNode::typeOpEq ); |
292 | } | 292 | } |
293 | | UNDEF OP_ADDSETP { | 293 | | LTR_UNDEF OP_ADDSETP { |
294 | bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); | 294 | bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); |
295 | } expr { | 295 | } expr { |
296 | bld.xAst.addNode( @3, AstNode::typeOpPlusEq ); | 296 | bld.xAst.addNode( @3, AstNode::typeOpPlusEq ); |
297 | } | 297 | } |
298 | | UNDEF OP_ADDSETR { | 298 | | LTR_UNDEF OP_ADDSETR { |
299 | bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); | 299 | bld.xAst.addNode( @$, AstNode::typeVariableRef, $1 ); |
300 | } expr { | 300 | } expr { |
301 | bld.xAst.addNode( @3, AstNode::typeOpPlusEqRaw ); | 301 | bld.xAst.addNode( @3, AstNode::typeOpPlusEqRaw ); |
@@ -436,7 +436,7 @@ function_for: for_base '{' function_exprs '}' { bld.xAst.closeNode(); } | |||
436 | * functions | 436 | * functions |
437 | */ | 437 | */ |
438 | 438 | ||
439 | function_def: TOK_FUNCTION UNDEF { | 439 | function_def: TOK_FUNCTION LTR_UNDEF { |
440 | bld.xAst.addNode( @1, AstNode::typeFunctionDef ); | 440 | bld.xAst.addNode( @1, AstNode::typeFunctionDef ); |
441 | bld.xAst.openBranch(); | 441 | bld.xAst.openBranch(); |
442 | bld.xAst.addNode( @2, AstNode::typeString, $2 ); | 442 | bld.xAst.addNode( @2, AstNode::typeString, $2 ); |
@@ -481,7 +481,7 @@ return: TOK_RETURN { | |||
481 | * Actions, they're basically functions, no parameters | 481 | * Actions, they're basically functions, no parameters |
482 | */ | 482 | */ |
483 | 483 | ||
484 | action_def: TOK_ACTION STRING { | 484 | action_def: TOK_ACTION LTR_STRING { |
485 | bld.xAst.addNode( @$, AstNode::typeActionDef ); | 485 | bld.xAst.addNode( @$, AstNode::typeActionDef ); |
486 | bld.xAst.openBranch(); | 486 | bld.xAst.openBranch(); |
487 | bld.xAst.addNode( @1, AstNode::typeString, $2 ); | 487 | bld.xAst.addNode( @1, AstNode::typeString, $2 ); |
@@ -564,7 +564,7 @@ target_rule: TOK_RULE { | |||
564 | } | 564 | } |
565 | ; | 565 | ; |
566 | 566 | ||
567 | condition: TOK_CONDITION CONDITION ';' { | 567 | condition: TOK_CONDITION LTR_CONDITION ';' { |
568 | bld.xAst.addNode( @$, AstNode::typeCondition, $2 ); | 568 | bld.xAst.addNode( @$, AstNode::typeCondition, $2 ); |
569 | } | 569 | } |
570 | | TOK_CONDITION TOK_ALWAYS ';'{ | 570 | | TOK_CONDITION TOK_ALWAYS ';'{ |
@@ -603,7 +603,7 @@ rule_exprs: | |||
603 | ; | 603 | ; |
604 | 604 | ||
605 | rule_input_func: function | 605 | rule_input_func: function |
606 | | STRING { | 606 | | LTR_STRING { |
607 | /* In this case, when the input is just a string, | 607 | /* In this case, when the input is just a string, |
608 | lets actually turn it into a call to the matches function. | 608 | lets actually turn it into a call to the matches function. |
609 | */ | 609 | */ |
@@ -671,7 +671,7 @@ config_exprs: | |||
671 | | config_exprs cache | 671 | | config_exprs cache |
672 | ; | 672 | ; |
673 | 673 | ||
674 | display: TOK_DISPLAY STRING ';' { | 674 | display: TOK_DISPLAY LTR_STRING ';' { |
675 | bld.xAst.addNode( @$, AstNode::typeDisplay, $2 ); | 675 | bld.xAst.addNode( @$, AstNode::typeDisplay, $2 ); |
676 | } | 676 | } |
677 | ; | 677 | ; |
@@ -720,7 +720,7 @@ cache: TOK_CACHE TOK_ALWAYS ';' | |||
720 | /* | 720 | /* |
721 | * target/profile execute | 721 | * target/profile execute |
722 | */ | 722 | */ |
723 | process_target: PROFILE | 723 | process_target: LTR_PROFILE |
724 | { | 724 | { |
725 | bld.xAst.addNode( @$, AstNode::typeProcessTarget ); | 725 | bld.xAst.addNode( @$, AstNode::typeProcessTarget ); |
726 | bld.xAst.openBranch(); | 726 | bld.xAst.openBranch(); |