.. _extensions-extparle: .. _ext-parle: ext/parle +++++++++ Extension Parser and Lexer. The parle extension provides lexing and parsing facilities. The implementation is based on » Ben Hanson's libraries and requires a » C++14 capable compiler. .. code-block:: php id */ $token = array( 'EOI' => 0, 'COMMA' => 1, 'CRLF' => 2, 'DECIMAL' => 3, ); /* id => name */ $token_rev = array_flip($token); $lex = new Lexer; $lex->push("[\x2c]", $token['COMMA']); $lex->push("[\r][\n]", $token['CRLF']); $lex->push("[\d]+", $token['DECIMAL']); $lex->build(); $in = "0,1,2\r\n3,42,5\r\n6,77,8\r\n"; $lex->consume($in); do { $lex->advance(); $tok = $lex->getToken(); if (Token::UNKNOWN == $tok->id) { throw new LexerException('Unknown token "'.$tok->value.'" at offset '.$tok->offset.'.'); } echo 'TOKEN: ', $token_rev[$tok->id], PHP_EOL; } while (Token::EOI != $tok->id); ?> See also `Parsing and Lexing `_. Specs _____ +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Extensions/Extparle | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Appinfo `, :ref:`CE `, :ref:`Changed Behavior ` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.12.12 | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+