#include <cparser.h>


Public Member Functions | |
| bool | GetCommand () |
| read one command from the buffer | |
| bool | FlushArg () |
| flush command buffer | |
| wxString | GetErrorMes () |
| get the error message if parsing went wrong | |
| wxUint32 | GetLineNumber () |
| bool | GetEnv (const wxString &envname, wxString &envstring) |
| get environment variable | |
| a2dVariablesArray & | GetArgumentList () |
| list of command arguments found | |
| wxString | GetItem (int i) |
| return the item at positions i | |
| a2dNamedProperty * | GetProperty (int i) |
| return the property at positions i | |
| int | GetCount () |
| return the total number of parsed items | |
| wxString | GetNextItem () |
| return the next property as string. | |
| a2dNamedProperty * | GetNextProp () |
| return a pointer to the next property in the list | |
| bool | GetNextItemBool () |
| get the next property as bool | |
| int | GetNextItemInt () |
| get the next property as int | |
| double | GetNextItemDouble () |
| get the next property as double | |
| bool | HasMoreItems () |
| return if the internal iterates on items has reached the end. | |
| wxString | GetCommandParsed () |
| get the parses command | |
Protected Member Functions | |
| bool | Blanks () |
| bool | Word () |
| bool | Number (const wxString &number) |
| bool | MultiPartWord () |
| bool | QuotedString () |
| bool | BracedString () |
| bool | Comment () |
| bool | VarRef (wxChar type) |
| bool | Name () |
| virtual wxChar | PeekNextC ()=0 |
| virtual void | IncC ()=0 |
Protected Attributes | |
| wxChar | a |
| a2dVariablesHash | m_aliaslist |
| a2dVariablesArray | m_argumentlist |
| wxString | m_commandsofar |
| wxString | m_error_mes |
| wxString | m_b |
| wxString | m_varref |
| int | m_item |
| wxUint32 | m_linenumber |
| last read line in DATA | |
strings according to the BNF below.
This parser, parses a string that can contain linefeeds/return (
). So the commands can spread over multiple line in files. Commands are seperated by [;] or [
] or []. But the last two only if it is really the end of the command, and not in one of the word parts that may contain these characters also. The characters between ["] ["] may contain alias and variable references, while in between [{] [}] will result in exactly what is literal there, also when there are [$] or [%].
examples:
Below you can see the Bachus Naur representation of the parser:
<commands> ::= [<blanks>] { <command> }*
<command> ::= [<blanks>] {<comment> | {<word> {<blanks> | <endcommand}}* }*
<endcommand> ::= {';' | '\n' | '\0' }
<word> ::= { <integer> | <real> | <quotedstring> | <bracedstring> | <multipartword> }
<quotedstring> ::= ('"') {CHAR | '\"' | '\\n' | aliasref | envref }* ('"')
<bracedstring> ::= ('{') {CHAR | '\{' | '\}' | '\\n'}* ('}')
<multipartword> ::= { <aliasref> | <envref> | {CHAR | '\\n'}* }*
<aliasref> ::= ('%') { <name> <blank> | ('{') <name> ('}') }
<envref> ::= ('$') { <name> <blank> | ('{') <name> ('}') }
<name> ::= { LETTER | DIGIT | UNDERSCORE | MINUS }*
<blanks> ::= { TAB | SPACE | '\\n'}*
<comment> ::= # {CHAR}* ('\0')
note:
[ ] entity CAN occur zero or more times
( ) entity MUST occur
{ } pick one of the entities within the braces
{ }* entities within the braces CAN occur zero ore more times
{ }+ entities within the braces MUST occur one ore more times
| OR
Definition at line 134 of file cparser.h.
| wxString a2dCommandParser::GetItem | ( | int | i | ) |
return the item at positions i
If called beyond the number of items available, an empty string is returned.
Definition at line 75 of file cparser.cpp.
| a2dNamedProperty * a2dCommandParser::GetProperty | ( | int | i | ) |
return the property at positions i
If called beyond the number of items available, NULL is returned.
Definition at line 83 of file cparser.cpp.
| wxString a2dCommandParser::GetNextItem | ( | ) |
return the next property as string.
After a FlushArg(), every call to GetNextItem() returns the next item in the parsed command. If called beyond the number of items available, an empty string is returned.
Definition at line 88 of file cparser.cpp.
| bool a2dCommandParser::HasMoreItems | ( | ) | [inline] |
return if the internal iterates on items has reached the end.
To next if more calls to GetNextItem() will return a real item.