From a3cb4c5d02f0ee75094fc27814c71f8a025d034b Mon Sep 17 00:00:00 2001 From: sbrandt Date: Wed, 3 Apr 2013 19:12:46 +0000 Subject: Add the basic grammar files, and the changes to the piraha code necessary to parse all of Cactus. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4990 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/piraha/pegs/configuration.peg | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/piraha/pegs/configuration.peg (limited to 'src/piraha/pegs/configuration.peg') diff --git a/src/piraha/pegs/configuration.peg b/src/piraha/pegs/configuration.peg new file mode 100644 index 00000000..ade602bc --- /dev/null +++ b/src/piraha/pegs/configuration.peg @@ -0,0 +1,32 @@ +# The skipper is a crucial sub-pattern +# that is activated by any whitespace in the +# grammar file +skipper = \b([\ \t\n\r\b]|\#[^\n]*|\\[\r\n])* + +any = [^] +keywords = \b(?i:script|lang|provides|requires|optional)\b +name = (?!{-keywords})(?i:[a-z_][a-z0-9_\.]*\b) +num = [+\-]?[0-9]+ +script = (?i: script( {name}|)) +lang = (?i: lang( {name}|)) + +option = {name} + +provides = (?i: + provides {name} \{ + ({script}? + {lang} + ( options {option}( {option})* |)|) + \} + ) + +requires = (?i: + requires (thorns:|) {name}([ \t]*{name})* + ) + +ifactive = (?i:_ifactive) +optional = (?i: + optional{ifactive}? {name}([ \t]+{name})* \{ ( {name} )* \} + ) + +config = ({provides} |{requires} |{optional} )* $ -- cgit v1.2.3