diff options
author | marha <marha@users.sourceforge.net> | 2011-01-19 20:29:24 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-19 20:29:24 +0000 |
commit | cbe6ed88f01b654241301539d8fa3f6111a0a6de (patch) | |
tree | 0fe25b7083dc4cc0c3e162fe18e9d427fcb712a5 /tools/mhmake/src/mhmakeparser.y | |
parent | cdc60fdcddbe5666aac11af34c6c030d4a670b99 (diff) | |
download | vcxsrv-cbe6ed88f01b654241301539d8fa3f6111a0a6de.tar.gz vcxsrv-cbe6ed88f01b654241301539d8fa3f6111a0a6de.tar.bz2 vcxsrv-cbe6ed88f01b654241301539d8fa3f6111a0a6de.zip |
Use bison instead of bison++
The += operator should also take the environment variables into account
Solved problem when & in redirect operator on command line
Solved syntax error when SPACE was follewed by SPACE
Removed kdevelop3 project files
Enable debug info in debug build on linux
Added support for foreach function
Fixed dependency problem for implicit rules with extra dependencies
Increased gnu make compatibility: allow implicit rules without commands
Solved wrong error message when it cannot build a target in mhmake_dbg
On windows: when checking the extension of a command: make sure a / does not cause a wrong decision
Added safety against recursive implicit rules.
Fixed wrong check on failure to open makefiles.
Make sure no message is printed when -include is used
flex and bison generated files: make sure the #line statements have the correct line numbers for the debugger after having added one line in the beginning of the file after running the flex/bison.
Make sure that the variable defined just before an error or message/info macro is defined when the message is generated.
mhmake_dbg: print error message when a target cannot be build because the directory of the target does not exist (and no rule is defined for it)
Reformatted message/info macro output
Also print makefile and line number when using error and message macro
Solved crash in mhmake_dbg when -C is specified on the command line
Solved problem in macro expansion when 2 patsubst inside each other
addprefix should not give an error when done on an empty string
Use comspec when echo is followed by a pipe character (piping is not supported by the echo internal command of mhmake)
Solved possible stack curruption (there was little chance that this was occuring)
Diffstat (limited to 'tools/mhmake/src/mhmakeparser.y')
-rw-r--r-- | tools/mhmake/src/mhmakeparser.y | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/tools/mhmake/src/mhmakeparser.y b/tools/mhmake/src/mhmakeparser.y index 515caf6e5..4c54ebd29 100644 --- a/tools/mhmake/src/mhmakeparser.y +++ b/tools/mhmake/src/mhmakeparser.y @@ -20,27 +20,38 @@ /* -------------- declaration section -------------- */
-%name mhmakeparser
-
-%define LLOC m_yyloc
-%define LTYPE int // This is the type of LLOC (defined in mhmakefileparser)
-
-%define LVAL m_theTokenValue
-%define STYPE TOKENVALUE // This is the type of LVAL (defined in mhmakefileparser)
-
-%define INHERIT : public mhmakefileparser
+%require "2.4.1"
+%defines
+%define parser_class_name "mhmakeparser"
+%define parser_base_class_name "mhmakefileparser"
+%define parser_class_constructor_init ": mhmakefileparser(CommandLineVariables)"
+%define parser_class_constructor_param "const map<string,string> &CommandLineVariables"
+%error-verbose
+
+%code requires {
+#include "mhmakefileparser.h"
+}
-%define CONSTRUCTOR_PARAM const map<string,string> &CommandLineVariables
-%define CONSTRUCTOR_INIT : mhmakefileparser(CommandLineVariables)
+%code provides {
+const char Test[]="dit is een test";
+}
-%header{
+%{
#include "mhmakefileparser.h"
#include "rule.h"
#include "util.h"
%}
+%locations
+%initial-action
+{
+ // Initialize the initial location.
+ @$.initialize(&m_ptheLexer->GetInputFilename());
+};
+
+%token END 0 "end of file"
%token <theString> COMMAND
-%token <theString> COMMA OPENBRACE CLOSEBRACE
+%token <theString> COMMA
%token <theString> STRING DOLLAREXPR EQUAL COLON DOUBLECOLON VARDEF VARVAL
%token IMEQUAL PEQUAL OPTEQUAL PHONY AUTODEPS EXPORT NEWLINE INCLUDEMAK SPACE VPATH
@@ -68,6 +79,10 @@ statements : | statements statement
;
+space : SPACE |
+ space SPACE
+;
+
statement: NEWLINE |
SPACE |
includemak |
@@ -161,11 +176,11 @@ autodepsrule: AUTODEPS COLON expression NEWLINE
;
-exportrule: EXPORT SPACE exportstrings NEWLINE
+exportrule: EXPORT space exportstrings NEWLINE
;
exportstrings : exportstring |
- exportstring SPACE exportstrings
+ exportstring space exportstrings
;
exportstring : STRING
@@ -175,7 +190,7 @@ exportstring : STRING }
;
-vpathrule: VPATH SPACE nonspaceexpression SPACE expression NEWLINE
+vpathrule: VPATH space nonspaceexpression space expression NEWLINE
{
SetvPath(ExpandExpression($3),ExpandExpression($5));
PRINTF(("Setting vpath %s to %s\n",$3.c_str(),ExpandExpression($5).c_str()));
@@ -203,7 +218,7 @@ imvarassignment: STRING IMEQUAL maybeemptyexpression pvarassignment: STRING PEQUAL maybeemptyexpression
{
- m_Variables[$1]=m_Variables[$1]+g_SpaceString+$3;
+ m_Variables[$1]=ExpandVar($1)+g_SpaceString+$3;
PRINTF(("Adding to variable %s: %s\n",$1.c_str(), $3.c_str()));
}
;
@@ -220,15 +235,15 @@ optvarassignment: STRING OPTEQUAL maybeemptyexpression maybeemptyexpression: NEWLINE {$$=g_EmptyString;} |
expression NEWLINE |
- expression SPACE NEWLINE
+ expression space NEWLINE
;
expression: nonspaceexpression |
- expression SPACE nonspaceexpression {$$=$1+g_SpaceString+$3;}
+ expression space nonspaceexpression {$$=$1+g_SpaceString+$3;}
;
expression_nocolorequal: nonspaceexpression_nocolorequal |
- expression_nocolorequal SPACE nonspaceexpression_nocolorequal {$$=$1+g_SpaceString+$3;}
+ expression_nocolorequal space nonspaceexpression_nocolorequal {$$=$1+g_SpaceString+$3;}
;
nonspaceexpression: simpleexpression |
@@ -246,10 +261,14 @@ simpleexpression: simpleexpression_nocolorequal | COMMA
;
-simpleexpression_nocolorequal: STRING {$$=$1;} |
- DOLLAREXPR {$$=$1;}
+simpleexpression_nocolorequal: STRING |
+ DOLLAREXPR
;
%%
/* -------------- body section -------------- */
+void yy::mhmakeparser::error (const yy::mhmakeparser::location_type& l, const std::string& m)
+{
+ cerr << l << " -> "<<m<<endl;
+}
|