GithubHelp home page GithubHelp logo

php-pegjs's People

Contributors

nordth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

php-pegjs's Issues

utf8 - ndash in grammar not recognised at runtime

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 "–"?

syntax error if the parse() is called multiple times

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

Strings with $ in the grammar don't escape $ in PHP

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.