2021-04-25 18:40:06 -03:00
|
|
|
//
|
|
|
|
|
// Created by intellij-pest on 2021-04-25
|
|
|
|
|
// makefile
|
|
|
|
|
// Author: Till Wegmueller <till.wegmueller@openflowlabs.com>
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
WHITESPACE = _{ " " | "\t" }
|
|
|
|
|
|
|
|
|
|
comment_string = _{
|
|
|
|
|
"#"
|
|
|
|
|
~ comment_character*
|
|
|
|
|
~ NEWLINE
|
|
|
|
|
}
|
|
|
|
|
comment_character = _{
|
|
|
|
|
!NEWLINE // if the following text is not three apostrophes
|
|
|
|
|
~ ANY // then consume one character
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 20:27:15 -03:00
|
|
|
variable_name_character = { UPPERCASE | ASCII_DIGIT | "_" | "." }
|
2021-04-25 18:40:06 -03:00
|
|
|
variable_name = @{ variable_name_character* }
|
|
|
|
|
variable_value_character = {
|
|
|
|
|
!NEWLINE
|
|
|
|
|
~ ANY
|
|
|
|
|
}
|
|
|
|
|
variable_value = @{ variable_value_character* }
|
|
|
|
|
|
2022-03-28 15:07:05 -03:00
|
|
|
variable_set = _{ "=" }
|
|
|
|
|
variable_add = _{ "+=" }
|
2021-04-25 18:40:06 -03:00
|
|
|
|
|
|
|
|
variable = { variable_name ~ ( variable_set | variable_add ) ~ variable_value? }
|
|
|
|
|
|
|
|
|
|
target_character = {
|
|
|
|
|
!":"
|
|
|
|
|
~ ANY
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
target_name = { target_character+ }
|
|
|
|
|
|
|
|
|
|
target = { target_name ~ ":" ~ variable_value }
|
|
|
|
|
|
|
|
|
|
include = { "include" ~ variable_value }
|
|
|
|
|
|
2022-03-28 15:07:05 -03:00
|
|
|
define_keyword = _{"define"}
|
|
|
|
|
define_end_keyword = _{NEWLINE ~ "endef"}
|
|
|
|
|
|
|
|
|
|
define_value_character = {
|
|
|
|
|
!define_end_keyword
|
|
|
|
|
~ ANY
|
|
|
|
|
}
|
|
|
|
|
define_value = @{ define_value_character* }
|
|
|
|
|
|
|
|
|
|
define = { define_keyword ~ variable_name ~ variable_set ~ NEWLINE ~ define_value ~ define_end_keyword }
|
|
|
|
|
|
|
|
|
|
makefile = { SOI ~ (NEWLINE | comment_string | define | variable | include | target )+ ~ EOI }
|