diff --git a/reference/parle/book.xml b/reference/parle/book.xml index fbee35eb715c..8c5e9655de9c 100644 --- a/reference/parle/book.xml +++ b/reference/parle/book.xml @@ -1,24 +1,23 @@ - - + Parsing and lexing Parle &reftitle.intro; - + &warn.experimental; The parle extension provides general purpose lexing and parsing facilities. The implementation is based on these libraries and requires a C++14 capable compiler. The lexer is based on the regex matching, the parser is LALR(1). Lexers and parsers are generated on the fly and can be used immediately after they've been finalized. Parle deals with parsing and lexing, the appropriate data structures representation and processing are the implementer's task. Serialization and code generation are not supported by the extension, yet. - - + + Lexer analysis is a process of splitting a character sequence into a list of lexemes. The lexeme list can be then used for the syntax analysis against a formal grammar. These operations are also known as lexing and parsing. This documentation doesn't aim to provide an exhaustive information on lexing and parsing. Good information in this regard is available on the numerous resources on the net. Several usage examples are included, to show the functionality. The extension is useful for PHP programmers both willing to learn or to utilize parsing and lexing. State machines and grammar parsing don't have to be implemented manually, these complex tasks are taken away by parle. Thanks to that, the development can be focused on the actual problem solving. - - + + The common use case for parle is, when a data format is too complex to be handled by the regex matching with PCRE. The practical application is herewith wide. Be it a specific data format, a behavior modification of existing functions, even an own programming language and beyond. The helper methods such as Parle\Lexer::dump to inspect the generated state machine, or Parle\Parser::dump to inspect the generated grammar, are useful. The method Parle\Parser::trace can also be used to track the parsing operation. - + &reference.parle.setup; @@ -36,7 +35,6 @@ &reference.parle.parle.parserexception; - - -
+
&reftitle.install; - + &pecl.info; &url.pecl.package;parle - - - -
+ +
- - + The Parle\ErrorInfo class Parle\ErrorInfo @@ -11,9 +10,9 @@
&reftitle.intro; - + The class represents detailed error information as supplied by Parle\Parser::errorInfo - +
@@ -48,7 +47,7 @@ token - + &Methods; @@ -57,7 +56,7 @@ - +
&reftitle.properties; @@ -65,19 +64,19 @@ id - Error id. + Error id. position - Position in the input, where the error occurred. + Position in the input, where the error occurred. token - If applicable - the Parle\Token related to the error, otherwise &null;. + If applicable - the Parle\Token related to the error, otherwise &null;. @@ -90,7 +89,6 @@ - - - + The Parle\Lexer class Parle\Lexer @@ -11,9 +10,9 @@
&reftitle.intro; - + Single state lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with Parle\Parser, the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. This lexer can give a certain performance advantage over Parle\RLexer, if no multiple states are required. Note, that Parle\RParser is not compatible with this lexer. - +
@@ -96,7 +95,7 @@ &Methods; - + @@ -110,35 +109,35 @@ Parle\Lexer::ICASE - + Parle\Lexer::DOT_NOT_LF - + Parle\Lexer::DOT_NOT_CRLF - + Parle\Lexer::SKIP_WS - + Parle\Lexer::MATCH_ZERO_LEN - + @@ -153,31 +152,31 @@ bol - Start of input flag. + Start of input flag. flags - Lexer flags. + Lexer flags. state - Current lexer state, readonly. + Current lexer state, readonly. marker - Position of the latest token match, readonly. + Position of the latest token match, readonly. cursor - Current input offset, readonly. + Current input offset, readonly. @@ -190,7 +189,6 @@ &reference.parle.parle.entities.lexer;
- - - + The Parle\LexerException class Parle\LexerException @@ -11,9 +10,9 @@
&reftitle.intro; - + - +
@@ -29,27 +28,27 @@ Parle\LexerException - + extends Exception - + Throwable &InheritedProperties; - + + - &Methods; - + &InheritedMethods; - + @@ -63,7 +62,6 @@ -->
- - - + The Parle\Parser class Parle\Parser @@ -11,9 +10,9 @@
&reftitle.intro; - + Parser class. Rules can be defined on the fly. Once finalized, a Parle\Lexer instance is required to deliver the token stream. - +
@@ -96,7 +95,7 @@ &Methods; - + @@ -110,56 +109,56 @@ Parle\Parser::ACTION_ERROR - + Parle\Parser::ACTION_SHIFT - + Parle\Parser::ACTION_REDUCE - + Parle\Parser::ACTION_GOTO - + Parle\Parser::ACTION_ACCEPT - + Parle\Parser::ERROR_SYNTAX - + Parle\Parser::ERROR_NON_ASSOCIATIVE - + Parle\Parser::ERROR_UNKNOWN_TOKEN - + @@ -174,13 +173,13 @@ action - Current parser action that matches one of the action class constants, readonly. + Current parser action that matches one of the action class constants, readonly. reduceId - Grammar rule id just processed in the reduce action. The value corresponds either to a token or to a production id. Readonly. + Grammar rule id just processed in the reduce action. The value corresponds either to a token or to a production id. Readonly. @@ -193,7 +192,6 @@ &reference.parle.parle.entities.parser;
- - - + The Parle\ParserException class Parle\ParserException @@ -11,9 +10,9 @@
&reftitle.intro; - + - +
@@ -29,27 +28,27 @@ Parle\ParserException - + extends Exception - + Throwable &InheritedProperties; - + + - &Methods; - + &InheritedMethods; - + @@ -63,7 +62,6 @@ -->
- - - + The Parle\RLexer class Parle\RLexer @@ -11,9 +10,9 @@
&reftitle.intro; - + Multistate lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with Parle\RParser, the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. Note, that Parle\Parser is not compatible with this lexer. - +
@@ -96,7 +95,7 @@ &Methods; - + @@ -110,35 +109,35 @@ Parle\RLexer::ICASE - + Parle\RLexer::DOT_NOT_LF - + Parle\RLexer::DOT_NOT_CRLF - + Parle\RLexer::SKIP_WS - + Parle\RLexer::MATCH_ZERO_LEN - + @@ -153,31 +152,31 @@ bol - Start of input flag. + Start of input flag. flags - Lexer flags. + Lexer flags. state - Current lexer state, readonly. + Current lexer state, readonly. marker - Position of the latest token match, readonly. + Position of the latest token match, readonly. cursor - Current input offset, readonly. + Current input offset, readonly. @@ -190,7 +189,6 @@ &reference.parle.parle.entities.rlexer;
- - - + The Parle\RParser class Parle\RParser @@ -11,9 +10,9 @@
&reftitle.intro; - + Parser class. Rules can be defined on the fly. Once finalized, a Parle\RLexer instance is required to deliver the token stream. - +
@@ -96,7 +95,7 @@ &Methods; - + @@ -110,56 +109,56 @@ Parle\RParser::ACTION_ERROR - + Parle\RParser::ACTION_SHIFT - + Parle\RParser::ACTION_REDUCE - + Parle\RParser::ACTION_GOTO - + Parle\RParser::ACTION_ACCEPT - + Parle\RParser::ERROR_SYNTAX - + Parle\RParser::ERROR_NON_ASSOCIATIVE - + Parle\RParser::ERROR_UNKNOWN_TOKEN - + @@ -174,13 +173,13 @@ action - Current parser action that matches one of the action class constants, readonly. + Current parser action that matches one of the action class constants, readonly. reduceId - Grammar rule id just processed in the reduce action. The value corresponds either to a token or to a production id. Readonly. + Grammar rule id just processed in the reduce action. The value corresponds either to a token or to a production id. Readonly. @@ -193,7 +192,6 @@ &reference.parle.parle.entities.rparser;
- - - + The Parle\Stack class Parle\Stack @@ -11,9 +10,9 @@
&reftitle.intro; - + Parle\Stack is a LIFO stack. The elements are inserted and removed only from one end. - +
@@ -31,7 +30,7 @@ - + &Properties; public @@ -52,7 +51,7 @@ &Methods; - + @@ -65,19 +64,19 @@ empty - Whether the stack is empty, readonly. + Whether the stack is empty, readonly. size - Stack size, readonly. + Stack size, readonly. top - Element on the top of the stack. + Element on the top of the stack. @@ -90,7 +89,6 @@ &reference.parle.parle.entities.stack;
- - - + The Parle\Token class Parle\Token @@ -11,9 +10,9 @@
&reftitle.intro; - + This class represents a token. Lexer returns instances of this class. - +
@@ -80,13 +79,13 @@ id - Token id. + Token id. value - Token value. + Token value. @@ -102,21 +101,21 @@ Parle\Token::EOI - End of input token id. + End of input token id. Parle\Token::UNKNOWN - Unknown token id. + Unknown token id. Parle\Token::SKIP - Skip token id. + Skip token id. @@ -130,7 +129,6 @@
- - - + Parle\Lexer::advance Process next lexer rule @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Lexer::advance - + - + Processes the next rule and prepares the resulting token data. - + @@ -26,14 +25,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Lexer::build Finalize the lexer rule set @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Lexer::build - + - + Rules, previously added with Parle\Lexer::push are finalized. This method call has to be done after all the necessary rules was pushed. The rule set becomes read only. The lexing can begin. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Lexer::callout Define token callback @@ -14,9 +13,9 @@ intid callablecallback - + Define a callback to be invoked once lexer encounters a particular token. - + @@ -25,17 +24,17 @@ id - + Token id. - + callback - + Callable to be invoked. The callable doesn't receive any arguments and its return value is ignored. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Lexer::consume Pass the data for processing @@ -13,9 +12,9 @@ public voidParle\Lexer::consume stringdata - - Consume the data for lexing. - + + Consume the data for lexing. + @@ -24,9 +23,9 @@ data - - Data to be lexed. - + + Data to be lexed. + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Lexer::dump Dump the state machine @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Lexer::dump - + - - Dump the current state machine to stdout. - + + Dump the current state machine to stdout. + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Lexer::getToken Retrieve the current token @@ -11,11 +10,11 @@ &reftitle.description; public Parle\TokenParle\Lexer::getToken - + - + Retrieve the current token. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - Returns an instance of Parle\Token. - + + Returns an instance of Parle\Token. + - - - + Parle\Lexer::insertMacro Insert regex macro @@ -14,9 +13,9 @@ stringname stringregex - + Insert a regex macro, that can be later used as a shortcut and included in other regular expressions. - + @@ -25,17 +24,17 @@ name - + Name of the macros. - + regex - + Regular expression. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Lexer::push Add a lexer rule @@ -15,9 +14,9 @@ intid - + Push a pattern for lexeme recognition. - + @@ -26,17 +25,17 @@ regex - + Regular expression used for token matching. - + id - + Token id. If the lexer instance is meant to be used standalone, this can be an arbitrary number. If the lexer instance is going to be passed to the parser, it has to be an id returned by Parle\Parser::tokenid. - + - - + Parle\Lexer::reset Reset lexer @@ -13,9 +12,9 @@ public voidParle\Lexer::reset intpos - + Reset lexing optionally supplying the desired offset. - + @@ -24,9 +23,9 @@ pos - + Reset position. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Parser::advance Process next parser rule @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Parser::advance - + - + Process next parser rule. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Parser::build Finalize the grammar rules @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Parser::build - + - + Any tokens and grammar rules previously added are finalized. The rule set becomes readonly and the parser is ready to start. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Parser::consume Consume the data for processing @@ -14,9 +13,9 @@ stringdata Parle\Lexerlexer - - Consume the data for parsing. - + + Consume the data for parsing. + @@ -25,17 +24,17 @@ data - - Data to be parsed. - + + Data to be parsed. + lexer - + A lexer object containing the lexing rules prepared for the particular grammar. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Parser::dump Dump the grammar @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Parser::dump - + - + Dump the current grammar to stdout. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Parser::errorInfo Retrieve the error information @@ -11,11 +10,11 @@ &reftitle.description; public Parle\ErrorInfoParle\Parser::errorInfo - + - + Retrieve the error information in case Parle\Parser::action returned the error action. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - + Returns an instance of Parle\ErrorInfo. - + - - - + Parle\Parser::left Declare a token with left-associativity @@ -13,9 +12,9 @@ public voidParle\Parser::left stringtok - + Declare a terminal with left associativity. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\Parser::nonassoc Declare a token with no associativity @@ -13,9 +12,9 @@ public voidParle\Parser::nonassoc stringtok - + Declare a terminal, that cannot appear more than once in the row. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\Parser::precedence Declare a precedence rule @@ -13,9 +12,9 @@ public voidParle\Parser::precedence stringtok - + Declares a precedence rule for a fictitious terminal symbol. This rule can be later used in the specific grammar rules. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\Parser::push Add a grammar rule @@ -14,9 +13,9 @@ stringname stringrule - + Push a grammar rule. The production id returned can be used later in the parsing process to identify the rule matched. - + @@ -25,17 +24,17 @@ name - + Rule name. - + rule - + The rule to be added. The syntax is Bison compatible. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - + Returns &integer; representing the rule index. - + - - - + Parle\Parser::reset Reset parser state @@ -13,9 +12,9 @@ public voidParle\Parser::reset inttokenId - + Reset parser state using the given token id. - + @@ -24,9 +23,9 @@ tokenId - + Token id. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Parser::right Declare a token with right-associativity @@ -13,9 +12,9 @@ public voidParle\Parser::right stringtok - + Declare a terminal with right associativity. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\Parser::sigil Retrieve a matching part of a rule @@ -13,9 +12,9 @@ public stringParle\Parser::sigil intidx - + Retrieve a part of the match by a rule. This method is equivalent to the pseudo variable functionality in Bison. - + @@ -24,9 +23,9 @@ idx - + Match index, zero based. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - Returns a &string; with the matched part. - + + Returns a &string; with the matched part. + - - - + Parle\Parser::sigilCount Number of elements in matched rule @@ -11,11 +10,11 @@ &reftitle.description; public intParle\Parser::sigilCount - + - + Get number of elements in the matched rule. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - + Returns &integer; - + - - - + Parle\Parser::sigilName Retrieve a rule or token name @@ -13,9 +12,9 @@ public stringParle\Parser::sigilName intidx - + Retrieve a partial rule name or token name corresponding to the sigil index. - + @@ -24,9 +23,9 @@ idx - + Match index, zero based. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - Returns a &string; with the matched part. - + + Returns a &string; with the matched part. + - - - + Parle\Parser::token Declare a token @@ -13,9 +12,9 @@ public voidParle\Parser::token stringtok - + Declare a terminal to be used in the grammar. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\Parser::tokenId Get token id @@ -13,9 +12,9 @@ public intParle\Parser::tokenId stringtok - + Retrieve the id of the named token. - + @@ -24,9 +23,9 @@ tok - + Name of the token as used in Parle\Parser::token. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - Returns &integer; representing the token id. - + + Returns &integer; representing the token id. + - - - + Parle\Parser::trace Trace the parser operation @@ -11,11 +10,11 @@ &reftitle.description; public stringParle\Parser::trace - + - + Retrieve the current parser operation description. This can be especially useful for studying the parser and to optimize the grammar. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - Returns a &string; with the trace information. - + + Returns a &string; with the trace information. + - - - + Parle\Parser::validate Validate input @@ -14,9 +13,9 @@ stringdata Parle\Lexerlexer - + Validate an input string. The string is parsed internally, thus this method is useful for the quick input validation. - + @@ -25,17 +24,17 @@ data - + String to be validated. - + lexer - + A lexer object containing the lexing rules prepared for the particular grammar. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - + Returns &boolean; witnessing whether the input chimes or not with the defined rules. - + - - - + Parle\RLexer::advance Process next lexer rule @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\RLexer::advance - + - + Processes the next rule and prepares the resulting token data. - + @@ -26,14 +25,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RLexer::build Finalize the lexer rule set @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\RLexer::build - + - + Rules, previously added with Parle\RLexer::push are finalized. This method call has to be done after all the necessary rules was pushed. The rule set becomes read only. The lexing can begin. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RLexer::callout Define token callback @@ -14,9 +13,9 @@ intid callablecallback - + Define a callback to be invoked once lexer encounters a particular token. - + @@ -25,17 +24,17 @@ id - + Token id. - + callback - + Callable to be invoked. The callable doesn't receive any arguments and its return value is ignored. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RLexer::consume Pass the data for processing @@ -13,9 +12,9 @@ public voidParle\RLexer::consume stringdata - - Consume the data for lexing. - + + Consume the data for lexing. + @@ -24,9 +23,9 @@ data - - Data to be lexed. - + + Data to be lexed. + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RLexer::dump Dump the state machine @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\RLexer::dump - + - - Dump the current state machine to stdout. - + + Dump the current state machine to stdout. + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RLexer::getToken Retrieve the current token @@ -11,11 +10,11 @@ &reftitle.description; public Parle\TokenParle\RLexer::getToken - + - + Retrive the current token. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - Returns an instance of Parle\Token. - + + Returns an instance of Parle\Token. + - - - + Parle\RLexer::insertMacro Insert regex macro @@ -14,9 +13,9 @@ stringname stringregex - + Insert a regex macro, that can be later used as a shortcut and included in other regular expressions. - + @@ -25,17 +24,17 @@ name - + Name of the macros. - + regex - + Regular expression. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RLexer::push Add a lexer rule @@ -29,11 +28,11 @@ stringregex stringnewState - + Push a pattern for lexeme recognition. - - A 'start state' and 'exit state' can be specified by using a suitable signature. - + + A 'start state' and 'exit state' can be specified by using a suitable signature. + @@ -42,39 +41,39 @@ regex - + Regular expression used for token matching. - + id - + Token id. If the lexer instance is meant to be used standalone, this can be an arbitrary number. If the lexer instance is going to be passed to the parser, it has to be an id returned by Parle\RParser::tokenid. - + state - + State name. If '*' is used as start state, then the rule is applied to all lexer states. - + newState - + New state name, after the rule was applied. - - + + If '.' is specified as the exit state, then the lexer state is unchanged when that rule matches. An exit state with '>' before the name means push. Use the signature without id for either continuation or to start matching, when a continuation or recursion is required. - - + + If '<' is specified as exit state, it means pop. In that case, the signature containing the id can be used to identify the match. Note that even in the case an id is specified, the rule will finish first when all the previous pushes popped. - + - - + Parle\RLexer::pushState Push a new start state @@ -13,9 +12,9 @@ public intParle\RLexer::pushState stringstate - - This lexer type can have more than one state machine. This allows you to lex different tokens depending on context, thus allowing simple parsing to take place. Once a state pushed, it can be used with a suitable Parle\RLexer::push signature variant. - + + This lexer type can have more than one state machine. This allows you to lex different tokens depending on context, thus allowing simple parsing to take place. Once a state pushed, it can be used with a suitable Parle\RLexer::push signature variant. + @@ -24,9 +23,9 @@ state - + Name of the state. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - - + + + - - - + Parle\RLexer::reset Reset lexer @@ -13,9 +12,9 @@ public voidParle\RLexer::reset intpos - + Reset lexing optionally supplying the desired offset. - + @@ -24,9 +23,9 @@ pos - + Reset position. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RParser::advance Process next parser rule @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\RParser::advance - + - + Prosess next parser rule. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RParser::build Finalize the grammar rules @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\RParser::build - + - + Any tokens and grammar rules previously added are finalized. The rule set becomes readonly and the parser is ready to start. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RParser::consume Consume the data for processing @@ -14,9 +13,9 @@ stringdata Parle\RLexerrlexer - - Consume the data for parsing. - + + Consume the data for parsing. + @@ -25,17 +24,17 @@ data - - Data to be parsed. - + + Data to be parsed. + lexer - + A lexer object containing the lexing rules prepared for the particular grammar. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RParser::dump Dump the grammar @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\RParser::dump - + - + Dump the current grammar to stdout. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RParser::errorInfo Retrieve the error information @@ -11,11 +10,11 @@ &reftitle.description; public Parle\ErrorInfoParle\RParser::errorInfo - + - + Retrieve the error information in case Parle\RParser::action returned the error action. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - + Returns an instance of Parle\ErrorInfo. - + - - - + Parle\RParser::left Declare a token with left-associativity @@ -13,9 +12,9 @@ public voidParle\RParser::left stringtok - + Declare a terminal with left associativity. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\RParser::nonassoc Declare a token with no associativity @@ -13,9 +12,9 @@ public voidParle\RParser::nonassoc stringtok - + Declare a terminal, that cannot appear more than once in the row. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\RParser::precedence Declare a precedence rule @@ -13,9 +12,9 @@ public voidParle\RParser::precedence stringtok - + Declares a precedence rule for a fictious terminal symbol. This rule can be later used in the specific grammar rules. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\RParser::push Add a grammar rule @@ -14,9 +13,9 @@ stringname stringrule - + Push a grammar rule. The production id returned can be used later in the parsing process to identify the rule matched. - + @@ -25,17 +24,17 @@ name - + Rule name. - + rule - + The rule to be added. The syntax is Bison compatible. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - + Returns &integer; representing the rule index. - + - - - + Parle\RParser::reset Reset parser state @@ -13,9 +12,9 @@ public voidParle\RParser::reset inttokenId - + Reset parser state using the given token id. - + @@ -24,9 +23,9 @@ tokenId - + Token id. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\RParser::right Declare a token with right-associativity @@ -13,9 +12,9 @@ public voidParle\RParser::right stringtok - + Declare a terminal with right associativity. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\RParser::sigil Retrieve a matching part of a rule @@ -13,9 +12,9 @@ public stringParle\RParser::sigil intidx - + Retrieve a part of the match by a rule. This method is equivalent to the pseudo variable functionality in Bison. - + @@ -24,9 +23,9 @@ idx - + Match index, zero based. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - Returns a &string; with the matched part. - + + Returns a &string; with the matched part. + - - - + Parle\RParser::sigilCount Number of elements in matched rule @@ -11,11 +10,11 @@ &reftitle.description; public intParle\RParser::sigilCount - + - + Get number of elements in the matched rule. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - + Returns &integer; - + - - - + Parle\RParser::sigilName Retrieve a rule or token name @@ -13,9 +12,9 @@ public stringParle\RParser::sigilName intidx - + Retrieve a partial rule name or token name corresponding to the sigil index. - + @@ -24,9 +23,9 @@ idx - + Match index, zero based. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - Returns a &string; with the matched part. - + + Returns a &string; with the matched part. + - - - + Parle\RParser::token Declare a token @@ -13,9 +12,9 @@ public voidParle\RParser::token stringtok - + Declare a terminal to be used in the grammar. - + @@ -24,9 +23,9 @@ tok - + Token name. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - + &return.void; - + - - - + Parle\RParser::tokenId Get token id @@ -13,9 +12,9 @@ public intParle\RParser::tokenId stringtok - + Retrieve the id of the named token. - + @@ -24,9 +23,9 @@ tok - + Name of the token as used in Parle\RParser::token. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - Returns &integer; representing the token id. - + + Returns &integer; representing the token id. + - - - + Parle\RParser::trace Trace the parser operation @@ -11,11 +10,11 @@ &reftitle.description; public stringParle\RParser::trace - + - + Retrieve the current parser operation description. This can be especially useful to study the parser and to optimize the grammar. - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - Returns a &string; with the trace information. - + + Returns a &string; with the trace information. + - - - + Parle\RParser::validate Validate input @@ -14,9 +13,9 @@ stringdata Parle\RLexerlexer - + Validate an input string. The string is parsed internally, thus this method is useful for the quick input validation. - + @@ -25,17 +24,17 @@ data - + String to be validated. - + lexer - + A lexer object containing the lexing rules prepared for the particular grammar. - + @@ -43,14 +42,13 @@ &reftitle.returnvalues; - + Returns &boolean; whitnessing whether the input chimes or not with the defined rules. - + - - - + Parle\Stack::pop Pop an item from the stack @@ -11,11 +10,11 @@ &reftitle.description; public voidParle\Stack::pop - + - + - + @@ -25,14 +24,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + Parle\Stack::push Push an item into the stack @@ -13,9 +12,9 @@ public voidParle\Stack::push mixeditem - + - + @@ -24,9 +23,9 @@ item - + Variable to be pushed. - + @@ -34,14 +33,13 @@ &reftitle.returnvalues; - - &return.void; - + + &return.void; + - - - + &reftitle.setup;
&reftitle.required; - + PHP 7.4 or above is supported. A C++14 capable compiler is required. A successful extension build was produced with at least clang 5.0, GCC 5.0 and Visual Studio 2015. - +
&reftitle.install; - + &pecl.moved; - - + + &pecl.info; &url.pecl.package;parle. - - - - Available configure options - - - - OptionDescription - - - - - --enable-parleEnable parle extension. - - - --enable-parle-utf32Enable internal UTF-32 support. Available since parle 0.7.2. - - - -
-
+ + + Available configure options + + + + OptionDescription + + + + + --enable-parleEnable parle extension. + + + --enable-parle-utf32Enable internal UTF-32 support. Available since parle 0.7.2. + + + +
-