a2dCommandParser Class Reference

base class used to parse command More...

#include <cparser.h>

Inheritance diagram for a2dCommandParser:

Inheritance graph
[legend]
Collaboration diagram for a2dCommandParser:

Collaboration graph
[legend]

List of all members.

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
a2dVariablesArrayGetArgumentList ()
 list of command arguments found
wxString GetItem (int i)
 return the item at positions i
a2dNamedPropertyGetProperty (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.
a2dNamedPropertyGetNextProp ()
 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


Detailed Description

base class used to parse command

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:

  1. %{variable1}${variable2}default/config/
  2. {1.0 um}
  3. {<none specified>="">}
  4. { TEXT; LAYER 0; \ TEXTTYPE 0; PRESENTATION 0,2,1; STRANS 0,0,0; MAG 400; \ XY 1; \ X 10000.000; Y 32900.000; \ STRING "correction factor: %aap um"; \ ENDEL;}
  5. some comment \

  1. {Save GDS-II file} SAVE {GDSII file (*.cal)|*.cal| GDS \ file (*.db)|*.db|ALL (*.*)|*.*} %{file_path} %{file_ext} curfile

See also:
a2dEvalCommandString

a2dFileLineParser


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.


Member Function Documentation

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.

Definition at line 197 of file cparser.h.


The documentation for this class was generated from the following files:
a2dCommandParser Class Reference -- Tue Aug 31 18:20:53 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation