diff options
author | June McEnroe <june@causal.agency> | 2021-01-02 15:13:07 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-02 15:13:07 -0500 |
commit | 6913d25841016c4ffdccd3b915bdf961090320af (patch) | |
tree | cb2eb9a86b05c567e0333c9df4df4e01ae5a4015 /bin/hilex | |
parent | Tag top-level typedefs the same way as function definitions (diff) | |
download | src-6913d25841016c4ffdccd3b915bdf961090320af.tar.gz src-6913d25841016c4ffdccd3b915bdf961090320af.zip |
Clean up make lexer
Still feels pretty messy though.
Diffstat (limited to 'bin/hilex')
-rw-r--r-- | bin/hilex/make.l | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/bin/hilex/make.l b/bin/hilex/make.l index 00c1acca..31b85574 100644 --- a/bin/hilex/make.l +++ b/bin/hilex/make.l @@ -25,14 +25,15 @@ %x Interp Shell ident [._[:alnum:]]+ -target [-/._[:alnum:]]+ -assign [!+:?]?= +assign [+?:!]?= +target [-._/?*\[\][:alnum:]]+ +operator [:!]|:: %% static int pop = INITIAL; static int depth = 0; -^"\t" { +^"\t"+ { BEGIN(pop = Shell); return Normal; } @@ -41,12 +42,15 @@ assign [!+:?]?= BEGIN(pop = INITIAL); return Normal; } - [^\n$]+|. { return Normal; } + "\\\n" { return Normal; } + [^\\\n$]+|. { return Normal; } } -[[:blank:]] { return Normal; } +[[:blank:]]+ { return Normal; } -"."(PHONY|PRECIOUS|SUFFIXES)/":"? { +{operator} { return Operator; } + +"."(PHONY|PRECIOUS|SUFFIXES)/{operator}? { return Keyword; } @@ -63,16 +67,19 @@ assign [!+:?]?= BEGIN(pop = INITIAL); return Normal; } - [^$[:space:]]+ { return String; } + "\\\n" { return String; } + [^\\$[:space:]]+|. { return String; } } -{target}([[:blank:]]+{target})*/":" { +^"-"?include { return Macro; } + +{target}([[:blank:]]+{target})*/{operator} { return IdentifierTag; } -^"-"?include { return Macro; } +{target} { return Identifier; } -"#".* { return Comment; } +"#"([^\\\n]|"\\"[^\n]|"\\\n")* { return Comment; } <*>{ "$"("{"|"(") { |