Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7540771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:43:15+00:00 2026-05-30T07:43:15+00:00

From Parsekit: how to match individual quote characters? If you define a parser: @start

  • 0

From Parsekit: how to match individual quote characters?

If you define a parser:

@start = int;
int = /[+-]?[0-9]+/

Unfortunately it isn’t going to be parsing any integers prefixed with a “+”, unless you include:

@numberState = "+" // at the top.

In the number parse above, the “Symbol” default parser wasn’t even mentioned, yet it is still active and overrides user defined parsers.

Okay so with numbers you can still fix it by adding the directive. What if you’re trying to create a parser for “++”? I haven’t found any directive that can make the following parser work.

@start = plusplus;
plusplus = "++";

The effects of default parsers on the user parser seems so arbitrary. Why can’t I parse “++”?

Is it possible to just turn off default Parsers altogether? They seem to get in the way if I’m not doing something common.

Or maybe I’ve got it all wrong.

EDIT:

I’ve found a parser that would parse plus plus:

@start = plusplus;
plusplus = plus plus;
plus = "+";

I am guessing the answer is: the literal symbols defined in your parser cannot overlap between default parsers; It must be contained completely by at least once of them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:43:17+00:00Added an answer on May 30, 2026 at 7:43 am

    Developer of ParseKit here.

    I have a few responses.

    1. I think you’ll find the ParseKit API highly elegant and sensible, the more you learn. Keep in mind that I’m not tooting my own horn by saying that. Although I built ParseKit, I did not design the ParseKit API. Rather, the design of ParseKit is based almost entirely on the designs found in Steven Metsker’s Building Parsers In Java. I highly recommend you checkout the book if you want to deeply understand ParseKit. Plus it’s a fantastic book about parsing in general.

    2. You’re confusing Tokenizer States with Parsers. They are two distinct things, but the details are more complex than I can answer here. Again, I recommend Metsker’s book.

    3. In the course of answering your question, I did find a small bug in ParseKit. Thanks! However, it was not affecting your outcome described above as you were not using the correct grammar to get the outcome it seems you were looking for. You’ll need to update your source code from The Google Code Project now, or else my advice below will not work for you.


    Now to answer your question.

    I think you are looking for a grammar which both recognizes ++ as a single multi-char Symbol token and also recognizes numbers with leading + chars as explicitly-positive numbers rather than a + Symbol token followed by a Number token.

    The correct grammar I believe you are looking for is something like this:

    @symbols = '++';    // declare ++ as a multi-char symbol
    @numberState = '+'; // allow explicitly-positive numbers
    @start = (Number|Symbol)*;
    

    Input like this:

    ++ +1 -2 + 3 ++
    

    Will be tokenized like so:

    [++, +1, -2, +, 3, ++]++/+1/-2/+/3/++^
    

    Two reminders:

    1. Again, you will need to update your source code now to see this work correctly. I had to fix a bug in this case.
    2. This stuff is tricky, and I recommend reading Metsker’s book to fully understand how ParseKit works.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From jmorecfg.h : #define PACK_TWO_PIXELS(l,r) ((r<<16) | l) #define PACK_NEED_ALIGNMENT(ptr) (((int)(ptr))&3) #define WRITE_TWO_PIXELS(addr, pixels)
From a desktop application developer point of view, is there any difference between developing
From http://www.doc.ic.ac.uk/teaching/projects/Distinguished03/AndrewSuffield.pdf : #include <string.h> struct x { char s[10]; int a[4]; }; void
From your experience, are there any security measures that one should undertake on a
I'm going through the ParseKit example and trying to modify it to suit my
From a web developer point of view, what changes are expected in the development
From what I've read, VS 2008 SP1 and Team Foundation Server SP1 packages are
From time to time I see an enum like the following: [Flags] public enum
From what information I could find, they both solve the same problems - more
From the Immediate Window in Visual Studio: > Path.Combine(@C:\x, y) C:\\x\\y > Path.Combine(@C:\x, @\y)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.