My Project
Static Public Member Functions | Public Attributes | List of all members
NPLMono.NPLParser Class Reference

Static Public Member Functions

static void enterlevel (NPLLex.LexState ls)
 
static void leavelevel (NPLLex.LexState ls)
 
static void next (NPLLex.LexState ls)
 
static void lookahead (NPLLex.LexState ls)
 
static void error_expected (NPLLex.LexState ls, int token)
 
static int testnext (NPLLex.LexState ls, int c)
 
static void check (NPLLex.LexState ls, int c)
 
static void check_match (NPLLex.LexState ls, int what, int who, int where)
 
static bool FillDataToXmlElement (XmlDocument doc, NPLLex.LexState ls, XmlElement ParentNode)
 Parse: data | table NPL uses a similar element name for basic data types as in soap and xml/rpc Supported NPL types are table, boolean, string, double, index, nil. More...
 
static XmlElement DataStatementToXmlElement (XmlDocument doc, NPLLex.LexState ls)
 Parse: name = data | table Basically, there is only one statement like msg = {...} in a web service or NPL activation call. More...
 
static XmlElement NPLCodeToXmlElement (string npl_code)
 converting from NPL code to xml element More...
 
static bool IsIdentifier (string input)
 whether the string is an identifier. More...
 
static void enterlevel (NPLLex.LexState ls)
 
static void leavelevel (NPLLex.LexState ls)
 
static void next (NPLLex.LexState ls)
 
static void lookahead (NPLLex.LexState ls)
 
static void error_expected (NPLLex.LexState ls, int token)
 
static int testnext (NPLLex.LexState ls, int c)
 
static void check (NPLLex.LexState ls, int c)
 
static void check_match (NPLLex.LexState ls, int what, int who, int where)
 
static bool FillDataToXmlElement (XmlDocument doc, NPLLex.LexState ls, XmlElement ParentNode)
 Parse: data | table NPL uses a similar element name for basic data types as in soap and xml/rpc Supported NPL types are table, boolean, string, double, index, nil. More...
 
static XmlElement DataStatementToXmlElement (XmlDocument doc, NPLLex.LexState ls)
 Parse: name = data | table Basically, there is only one statement like msg = {...} in a web service or NPL activation call. More...
 
static XmlElement NPLCodeToXmlElement (string npl_code)
 converting from NPL code to xml element More...
 
static bool IsIdentifier (string input)
 whether the string is an identifier. More...
 

Public Attributes

const int LUA_MAXPARSERLEVEL = 200
 

Member Function Documentation

§ DataStatementToXmlElement() [1/2]

static XmlElement NPLMono.NPLParser.DataStatementToXmlElement ( XmlDocument  doc,
NPLLex.LexState  ls 
)
inlinestatic

Parse: name = data | table Basically, there is only one statement like msg = {...} in a web service or NPL activation call.

Parameters
doc
ls
Returns
XmlElement with the name is returned. null is returned if input is invalid

§ DataStatementToXmlElement() [2/2]

static XmlElement NPLMono.NPLParser.DataStatementToXmlElement ( XmlDocument  doc,
NPLLex.LexState  ls 
)
inlinestatic

Parse: name = data | table Basically, there is only one statement like msg = {...} in a web service or NPL activation call.

Parameters
doc
ls
Returns
XmlElement with the name is returned. null is returned if input is invalid

§ FillDataToXmlElement() [1/2]

static bool NPLMono.NPLParser.FillDataToXmlElement ( XmlDocument  doc,
NPLLex.LexState  ls,
XmlElement  ParentNode 
)
inlinestatic

Parse: data | table NPL uses a similar element name for basic data types as in soap and xml/rpc Supported NPL types are table, boolean, string, double, index, nil.

e.g. the NPL table msg={x=2, [1]="string value",OK=true} will be serialized to following table. <msg> <x type="double">2</x> string value

<OK type="boolean">true</OK> </msg> the input NPL table key name better not be the above name to avoid confusion.

Parameters
doc
ls
ParentNode
Returns
true if there are data to fill

Note:2008.3.27: I found that the xmlserializer strips away
out during deserialization (and just leave
). WebService strips out
(an leave
) even using XMLNode.SetInnerText(). so the msg code sending using InnerText of XML web service call will have removed. This leads to errors for scode. A workaround is to replace and
with &#x000d; and &#x000a; respectively in FillDataToXmlElement of NPLParser.cs for string type. In fact, I just replace , since
is not removed.

Fixed: 2008.6.3 LiXizhi the following is for auto indexed table items {"string1", "string2\r\n", 213, nil,["A"]="B", true, false, {"another table", "field1"}}

§ FillDataToXmlElement() [2/2]

static bool NPLMono.NPLParser.FillDataToXmlElement ( XmlDocument  doc,
NPLLex.LexState  ls,
XmlElement  ParentNode 
)
inlinestatic

Parse: data | table NPL uses a similar element name for basic data types as in soap and xml/rpc Supported NPL types are table, boolean, string, double, index, nil.

e.g. the NPL table msg={x=2, [1]="string value",OK=true} will be serialized to following table. <msg> <x type="double">2</x> string value

<OK type="boolean">true</OK> </msg> the input NPL table key name better not be the above name to avoid confusion.

Parameters
doc
ls
ParentNode
Returns
true if there are data to fill

Note:2008.3.27: I found that the xmlserializer strips away
out during deserialization (and just leave
). WebService strips out
(an leave
) even using XMLNode.SetInnerText(). so the msg code sending using InnerText of XML web service call will have removed. This leads to errors for scode. A workaround is to replace and
with &#x000d; and &#x000a; respectively in FillDataToXmlElement of NPLParser.cs for string type. In fact, I just replace , since
is not removed.

Fixed: 2008.6.3 LiXizhi the following is for auto indexed table items {"string1", "string2\r\n", 213, nil,["A"]="B", true, false, {"another table", "field1"}}

§ IsIdentifier() [1/2]

static bool NPLMono.NPLParser.IsIdentifier ( string  input)
inlinestatic

whether the string is an identifier.

Identifiers in npl can be any string of letters, digits, and underscores, not beginning with a digit. This coincides with the definition of identifiers in most languages. (The definition of letter depends on the current locale: any character considered alphabetic by the current locale can be used in an identifier.)

Parameters
strstring
nLengthit must be a valid length.

§ IsIdentifier() [2/2]

static bool NPLMono.NPLParser.IsIdentifier ( string  input)
inlinestatic

whether the string is an identifier.

Identifiers in npl can be any string of letters, digits, and underscores, not beginning with a digit. This coincides with the definition of identifiers in most languages. (The definition of letter depends on the current locale: any character considered alphabetic by the current locale can be used in an identifier.)

Parameters
strstring
nLengthit must be a valid length.

§ NPLCodeToXmlElement() [1/2]

static XmlElement NPLMono.NPLParser.NPLCodeToXmlElement ( string  npl_code)
inlinestatic

converting from NPL code to xml element

Parameters
npl_codethe statement must be like msg = {...}
Returns

read first token

§ NPLCodeToXmlElement() [2/2]

static XmlElement NPLMono.NPLParser.NPLCodeToXmlElement ( string  npl_code)
inlinestatic

converting from NPL code to xml element

Parameters
npl_codethe statement must be like msg = {...}
Returns

read first token


The documentation for this class was generated from the following file: