Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roller roll play fails with peg$SyntaxError #1

Closed
Kodiologist opened this issue Nov 16, 2023 · 4 comments
Closed

roller roll play fails with peg$SyntaxError #1

Kodiologist opened this issue Nov 16, 2023 · 4 comments

Comments

@Kodiologist
Copy link

file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:4919
  var self = Error.call(this, message);
                   ^

peg$SyntaxError: Expected "(", "-", "abs", "ceil", "cos", "d", "d%", "dF", "exp", "floor", "log", "max", "min", "pow", "round", "sign", "sin", "sqrt", "tan", "{", [0-9], or [1-9] but "p" found.
    at new peg$SyntaxError (file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:4919:20)
    at peg$buildStructuredError (file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:5425:12)
    at peg$parse (file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:7185:11)
    at Parser.parse (file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:7226:12)
    at new DiceRoll (file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:7398:40)
    at file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:7949:24
    at Array.map (<anonymous>)
    at DiceRoller.roll (file:///usr/local/lib/node_modules/@dice-roller/cli/node_modules/@dice-roller/rpg-dice-roller/lib/esm/bundle.js:7948:37)
    at Object.default [as handler] (file:///usr/local/lib/node_modules/@dice-roller/cli/lib/roll.js:28:10)
    at /usr/local/lib/node_modules/@dice-roller/cli/node_modules/yargs/build/index.cjs:1:8993 {
  expected: [
    { type: 'literal', text: 'abs', ignoreCase: false },
    { type: 'literal', text: 'ceil', ignoreCase: false },
    { type: 'literal', text: 'cos', ignoreCase: false },
    { type: 'literal', text: 'exp', ignoreCase: false },
    { type: 'literal', text: 'floor', ignoreCase: false },
    { type: 'literal', text: 'log', ignoreCase: false },
    { type: 'literal', text: 'round', ignoreCase: false },
    { type: 'literal', text: 'sign', ignoreCase: false },
    { type: 'literal', text: 'sin', ignoreCase: false },
    { type: 'literal', text: 'sqrt', ignoreCase: false },
    { type: 'literal', text: 'tan', ignoreCase: false },
    { type: 'literal', text: 'pow', ignoreCase: false },
    { type: 'literal', text: 'max', ignoreCase: false },
    { type: 'literal', text: 'min', ignoreCase: false },
    {
      type: 'class',
      parts: [ [ '1', '9' ] ],
      inverted: false,
      ignoreCase: false
    },
    { type: 'literal', text: '(', ignoreCase: false },
    { type: 'literal', text: 'd', ignoreCase: false },
    {
      type: 'class',
      parts: [ [ '1', '9' ] ],
      inverted: false,
      ignoreCase: false
    },
    { type: 'literal', text: '(', ignoreCase: false },
    { type: 'literal', text: 'd%', ignoreCase: false },
    {
      type: 'class',
      parts: [ [ '1', '9' ] ],
      inverted: false,
      ignoreCase: false
    },
    { type: 'literal', text: '(', ignoreCase: false },
    { type: 'literal', text: 'dF', ignoreCase: false },
    { type: 'literal', text: '-', ignoreCase: false },
    {
      type: 'class',
      parts: [ [ '0', '9' ] ],
      inverted: false,
      ignoreCase: false
    },
    { type: 'literal', text: '(', ignoreCase: false },
    { type: 'literal', text: '{', ignoreCase: false }
  ],
  found: 'p',
  location: {
    source: undefined,
    start: { offset: 0, line: 1, column: 1 },
    end: { offset: 1, line: 1, column: 2 }
  }
}

Node.js v18.13.0
@GreenImp
Copy link
Contributor

It looks like the notation was invalid.

What notation were you trying to roll?

@Kodiologist
Copy link
Author

Nothing really. I just started the program with roller roll play and got this.

@Kodiologist
Copy link
Author

Looking at the README again, it looks like the actual syntax is roller play. So this is PEBKAC except perhaps for an excessively verbose error message.

@GreenImp
Copy link
Contributor

GreenImp commented Nov 17, 2023

Ah yes of course, it sees play as invalid dice notation.

I'm glad you figured it out!

In terms of the extremely verbose error message, a ticket has already been raised for that, which you're welcome to take a look at:

dice-roller/rpg-dice-roller#278

If you're able to help with it, then that would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants