silverstripe-framework/thirdparty/php-peg/examples/CalculatedLiterals.peg.inc

26 lines
474 B
PHP
Raw Normal View History

2011-02-09 04:53:59 +01:00
<?php
require '../Parser.php' ;
class CalculatedLiterals extends Parser {
/*!* CalculatedLiterals
string: ( /\\./ | /[^${parent.q}]/ )*
simplequote: q:/['"]/ string '$q'
freequote-matched: "qq" q:/[{\[(<]/ string '$matched'
function $matched( $res ) {
$a = array( '{' => '}', '[' => ']', '(' => ')', '<' => '>' ) ;
return $a[$res['q']] ;
}
freequote-unmatched: "qq" q:/./ string '$q'
quoted-string: freequote-matched | freequote-unmatched | simplequote
*/
}