TECEvent

The TECEvent function encapsulates the code for parsing event definitions into a class name and attribute=value pairs.

Synopsis

TECEvent()
init(String event)

Arguments

event
The event string to be parsed. Here are some examples of valid event strings:
Class1;msg='text.';hostname=artemis;source=TEC;END
Class2;END
Class3;msg=theMessage;END
A valid event string has the following form:
ID SEMICLN ( ID = (STRING | VALUE | EMPTY_STRING) SEMICLN )* "END"[CTRL_A]
The tokens for the event string grammar are explained as follows:
SEMICLN := ";"
EQUALS := "="
CNTRL_A := "\001"
ID := Any non-empty sequence of characters from the set
a-z, A-Z, 0-9, _, -, .
containing at least one character from
a-z, A-Z
STRING :=
Begins and ends with either single quotes or double quotes. Any embedded quotes that are the same as the quotes being used to delimit the string must be escaped with the same quote character. For example:
  • 'embedded single(')' would be written 'embedded single('')'
  • "embedded double(")" would be written "embedded double("")"
  • "embedded single(')" would be written "embedded single(')"
Note: STRING tokens cannot contain the NUL character ('\000') or control-A ('\001')
VALUE :=
Any non-empty sequence of characters excluding the following:
  • all ASCII control characters ("" - "")
  • the space character (" ")
  • the single quote ("'")
  • the equal sign ("=")
  • the semi-colon (";")
EMPTY_STRING := This token represents an empty string. Quotes are not needed for this value.
The first ID token is the class name of the event. The sequence of instances of "ID=(STRING|VALUE);" specifies the slot/value pairs and"END" marks the end of the event. The terminating character ^A is optional. Each ID used as a slot name must be unique with respect to all the other IDs used as slot names and the slot name cannot be "END". There can be an arbitrary amount of whitespace (characters " ", "\t", "\r", "\n") before and after any of the tokens in an event string, with the following exception. If a terminating ^A is present, nothing can appear after it. Examples of valid event strings are as follows:
Class1;    
     msg='embedded quote ''.' ;   
     hostname=artemis; 
END
Class2;END^A
Class3;  msg = theMessage ; END
Class4;   
     msg='Here''s a newline   
     rest of msg'; 
END

Examples

public boolean init(String event);

Return codes

The return code for the init() call is true when the event string is parsed successfully, and false if it is not.