X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvmc%2FConfigLexer.l;h=34b9a17de189037e5dd08050fd685b0981e0c394;hb=9ba8a76f8baaa1092d60ccfbc04e7efdc207c98f;hp=d9a44c1d228a1c9df3e8545c0a7e39bb6d82733c;hpb=ec4f588418d13fcbba73553a71993398f3af7c1b;p=oota-llvm.git diff --git a/tools/llvmc/ConfigLexer.l b/tools/llvmc/ConfigLexer.l index d9a44c1d228..34b9a17de18 100644 --- a/tools/llvmc/ConfigLexer.l +++ b/tools/llvmc/ConfigLexer.l @@ -18,7 +18,6 @@ %option never-interactive %option batch %option noyywrap -%option nodefault %option 8bit %option outfile="ConfigLexer.cpp" %option ecs @@ -65,7 +64,7 @@ handleSubstitution(llvm::ConfigLexerTokens token) { } YY_FATAL_ERROR("Substitition tokens not allowed in names" ); return ERRORTOK; -}; +} inline llvm::ConfigLexerTokens handleValueContext(llvm::ConfigLexerTokens token) { ConfigLexerState.StringVal = yytext; @@ -79,6 +78,7 @@ inline llvm::ConfigLexerTokens handleValueContext(llvm::ConfigLexerTokens token) ASSEMBLER assembler|Assembler|ASSEMBLER COMMAND command|Command|COMMAND LANG lang|Lang|LANG +LIBS libs|Libs|LIBS LINKER linker|Linker|LINKER NAME name|Name|NAME OPT1 opt1|Opt1|OPT1 @@ -100,7 +100,7 @@ False false|False|FALSE|off|Off|OFF|no|No|NO Bytecode bc|BC|bytecode|Bytecode|BYTECODE Assembly asm|ASM|assembly|Assembly|ASSEMBLY -BadSubst \%[^iots][a-zA-Z]\% +BadSubst \%[a-zA-Z]*\% Comment \#[^\r\n]*\r?\n NewLine \r?\n Eq \= @@ -113,7 +113,7 @@ White [ \t]* %% -{White} { /* Ignore whitespace */ } +{White} { if (ConfigLexerState.in_value) return SPACE; } {Comment} { /* Ignore comments */ ConfigLexerState.in_value = false; @@ -134,9 +134,12 @@ White [ \t]* return EQUALS; } -{VERSION} { return handleNameContext(VERSION); } +{Sep} { return SEPARATOR; } + +{VERSION} { return handleNameContext(VERSION_TOK); } {LANG} { return handleNameContext(LANG); } +{LIBS} { return handleNameContext(LIBS); } {NAME} { return handleNameContext(NAME); } {OPT1} { return handleNameContext(OPT1); } {OPT2} { return handleNameContext(OPT2); } @@ -160,13 +163,27 @@ White [ \t]* {LINKER} { return handleNameContext(LINKER); } %args% { return handleSubstitution(ARGS_SUBST); } +%bindir% { return handleSubstitution(BINDIR_SUBST); } +%defs% { return handleSubstitution(DEFS_SUBST); } %in% { return handleSubstitution(IN_SUBST); } +%incls% { return handleSubstitution(INCLS_SUBST); } +%libdir% { return handleSubstitution(LIBDIR_SUBST); } +%libs% { return handleSubstitution(LIBS_SUBST); } +%llvmgccdir% { return handleSubstitution(LLVMGCCDIR_SUBST); } +%llvmgccarch% { return handleSubstitution(LLVMGCCARCH_SUBST); } +%llvmgcc% { return handleSubstitution(LLVMGCC_SUBST); } +%llvmgxx% { return handleSubstitution(LLVMGXX_SUBST); } +%llvmcc1% { return handleSubstitution(LLVMCC1_SUBST); } +%llvmcc1plus% { return handleSubstitution(LLVMCC1PLUS_SUBST); } +%opt% { return handleSubstitution(OPT_SUBST); } %out% { return handleSubstitution(OUT_SUBST); } -%time% { return handleSubstitution(TIME_SUBST); } %stats% { return handleSubstitution(STATS_SUBST); } -%opt% { return handleSubstitution(OPT_SUBST); } %target% { return handleSubstitution(TARGET_SUBST); } -{BadSubst} { YY_FATAL_ERROR("Invalid substitution token"); } +%time% { return handleSubstitution(TIME_SUBST); } +%verbose% { return handleSubstitution(VERBOSE_SUBST); } +%fOpts% { return handleSubstitution(FOPTS_SUBST); } +%MOpts% { return handleSubstitution(MOPTS_SUBST); } +%WOpts% { return handleSubstitution(WOPTS_SUBST); } {Assembly} { return handleValueContext(ASSEMBLY); } {Bytecode} { return handleValueContext(BYTECODE); } @@ -179,8 +196,6 @@ White [ \t]* --ConfigLexerState.StringVal.end()); return STRING; } -{Sep} { if (ConfigLexerState.in_value) { ConfigLexerState.StringVal = yytext; - return OPTION; } } - +{BadSubst} { YY_FATAL_ERROR("Invalid substitution token"); } %%