ips/userland/src/makefile.pest

55 lines
1.2 KiB
Text
Raw Normal View History

//
// 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
}
variable_name_character = { UPPERCASE | ASCII_DIGIT | "_" }
variable_name = @{ variable_name_character* }
variable_value_character = {
!NEWLINE
~ ANY
}
variable_value = @{ variable_value_character* }
variable_set = _{ "=" }
variable_add = _{ "+=" }
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 }
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 }