From 888a77213a1ea67215b61c55f2cd6e8a13ffa3fd Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 30 Aug 2013 11:25:04 -0700 Subject: [PATCH] Testing - Added test script and initial grammar file. --- src/parser/.gitignore | 2 ++ src/parser/grammar.bnf | 82 ++++++++++++++++++++++++++++++++++++++++++ src/parser/run | 1 + 3 files changed, 85 insertions(+) create mode 100644 src/parser/.gitignore create mode 100644 src/parser/grammar.bnf create mode 100755 src/parser/run diff --git a/src/parser/.gitignore b/src/parser/.gitignore new file mode 100644 index 000000000..8b2663be7 --- /dev/null +++ b/src/parser/.gitignore @@ -0,0 +1,2 @@ +libparser.a +parser diff --git a/src/parser/grammar.bnf b/src/parser/grammar.bnf new file mode 100644 index 000000000..b2956a867 --- /dev/null +++ b/src/parser/grammar.bnf @@ -0,0 +1,82 @@ +# The command line needs to obey a grammar. It is against this grammar that +# bugs will be identified. +# +# Conventions: +# - Literals are always double-quoted. +# - "*", "+" and "?" suffixes have POSIX semantics. +# - Low-level primitives are in . +# - @name for entity lists such as custom report names. +# +# The general form of commands is: +# task [ all-commands ] +# + + grammar ::= all-commands? + ; + + all-commands ::= report-command + | read-command +# | write-command + | special-command + ; + + report-command ::= filter @report ; + read-command ::= filter @readcmd ; +# write-command ::= filter @writecmd modifiers ; + special-command ::= ; + + filter ::= expression? ; + + expression ::= term "and" expression + | term "or" expression + | term + ; + +# modifiers ::= ; + +# Low-level: + +# dom ::= context-value +# | system-value +# | rc-value +# | task-value +# ; + +# context-value ::= "context.program" +# | "context.args" +# | "context.width" +# | "context.height" +# ; + +# system-value ::= "system.version" +# | "system.os" +# ; + +# rc-value ::= /rc\.[a-zA-Z.]+/ +# ; + +# task-value ::= "." @attribute +# | "." @attribute +# ; + +# literal ::= +# | +# | +# | +# ; + +# Supported primitives: +# +# +# +# "rc." name "=" string +# " ... " +# +# ISO-8601 date +# ISO-8601 duration +# @command all commands +# @report all custom reports +# @attribute all attributes, UDAs +# @readcmd all read-only commands +# @writecmd all write commands + diff --git a/src/parser/run b/src/parser/run new file mode 100755 index 000000000..2e2e252ce --- /dev/null +++ b/src/parser/run @@ -0,0 +1 @@ +./parser $* grammar.bnf 123 mod pro:H