nordth / php-pegjs Goto Github PK
View Code? Open in Web Editor NEWPHP target for pegjs parser generator
License: MIT License
PHP target for pegjs parser generator
License: MIT License
if I include a n-long dash in the grammar ("–") I'm getting a parse error that "\u2013" is expected but "–" was found
Syntax error: Expected " ", "\u2013" or end of input but "–" found. At line 1 column 7 offset 6
I'm not that familiar with php support for unicode, what should I do to parse input with "–"?
i've got a pet grammar
start = digits:[0-9]+ {
return intval(join('', $digits));
}
include "pet.php";
try {
$parser = new PhpPegJs\Parser;
$result = $parser->parse('26');
$result = $parser->parse('27'); // HERE IT CHOKES
} catch (PhpPegJs\SyntaxError $ex) {
$message = "Syntax error: " . $ex->getMessage() . ' At line ' . $ex->grammarLine . ' column ' . $ex->grammarColumn . ' offset ' . $ex->grammarOffset . "\n";
echo $message;
}
Syntax error: Expected [0-9] but end of input found. At line 1 column 3 offset 2
this is independent of the grammar I use
{f1: "val1", f2: "val2"] array("val1", "val2")
This row and the second one are mixed.
For example,
$callback from the grammar at https://github.com/auth0/node-odata-parser/blob/master/src/odata.pegjs on line 182.
results in
$this->peg_c117 = "$callback=";
$this->peg_c118 = array( "type" => "literal", "value" => "$callback=", "description" => "\"$callback=\"" );
but should result in
$this->peg_c117 = "\$callback=";
$this->peg_c118 = array( "type" => "literal", "value" => "\$callback=", "description" => "\"\$callback=\"" );
Without the escaped character, PHP tries to interpret $callback as a variable since it is in a double-quote string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.