From 6913d25841016c4ffdccd3b915bdf961090320af Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sat, 2 Jan 2021 15:13:07 -0500 Subject: Clean up make lexer Still feels pretty messy though. --- bin/hilex/make.l | 27 +++++++++++++++++---------- 1 file 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; } <*>{ "$"("{"|"(") { -- cgit 1.4.1 n value='author'>author
path: root/port/file2c (unfollow)
Commit message (Expand)Author
2020-12-31Add ASCII control code names to bitJune McEnroe
2020-12-31Simplify bit lexing and parsingJune McEnroe
2020-12-31Add ddateJune McEnroe
2020-12-30Print octal for 8 bits in bitJune McEnroe
2020-12-30Add unary & to bitJune McEnroe
2020-12-30Support unary + in orderJune McEnroe
2020-12-30Add postfix $ operator to bitJune McEnroe
2020-12-29Add make lexerJune McEnroe
2020-12-29Clean up C lexerJune McEnroe
2020-12-29Clean up hilex code somewhatJune McEnroe
2020-12-29Match lex/yacc %% %{ %} lines as MacroJune McEnroe
2020-12-29Match top-level C definitions as IdentifierTagJune McEnroe
2020-12-29Match C type declarations as IdentifierTagJune McEnroe
2020-12-29Match function-like macro definitions as IdentifierTagJune McEnroe
2020-12-29Reconfigure C macro start conditionsJune McEnroe
2020-12-29Document HTML class namesJune McEnroe
2020-12-29Rename Tag class to IdentifierTagJune McEnroe
2020-12-29Change HTML class from hi to hilexJune McEnroe
2020-12-29Add hilex HTML outputJune McEnroe