Page History
...
Code Block |
---|
Tokens = SRP_String("TokenizeCode", String, WhitespaceOptions, IncludeComments, ref State) |
Parameters
Parameter | Description |
---|---|
String | A string of BASIC+ code. (REQUIRED) |
WhitespaceOptions | Whitespace tokenizing options. (OPTIONAL, Default="None") |
IncludeComments | TRUE to include comments, FALSE to omit them. (OPTIONAL, Default=0) |
State | The state to start the parser. |
Returns
An @FM delimited array of strings, each one a BASIC+ token.
...
IncludeComments: This true/false parameter determines whether or not comment tokens are included in the output. The default is FALSE.
State. This parameter was added in SRP Utilities 2.1. It's a numerical value indicating the parser state. This is useful if you are parsing code line by line and want to preserve the state of the code from one line to the next. The best way to use this parameter is to create a variable called State and set it to "". Then pass it into this service, which will update your variable after each call. Pass it as is, and you'll be passing the previous state into the parser.
Example
Code Block |
---|
// Sample code Code = "A = B + C; // This is a simple expression" // Output will be: "A":@FM:"=":@FM:"B":@FM:"+":@FM:"C":@FM:";" Tokens = SRP_String("TokenizeCode") // Output will be: "A":@FM:" ":@FM:"=":@FM:" ":@FM:"B":@FM:" ":@FM:"+"::@FM:" "@FM:"C":@FM:";":@FM:" ":@FM:\0D0A\ Tokens = SRP_String("TokenizeCode", "AllWhitespace") // Output will be: "A":@FM:"=":@FM:"B":@FM:"+":@FM:"C":@FM:";":@FM:\0D0A\ Tokens = SRP_String("TokenizeCode", "LineBreaksOnly") // Output will be: "A":@FM:"=":@FM:"B":@FM:"+":@FM:"C":@FM:";":@FM:"// This is a simple expression" Tokens = SRP_String("TokenizeCode", "None", 1) |
...