Giter Club home page Giter Club logo

peg-sharp's People

Watchers

James Cloos avatar

peg-sharp's Issues

How to detect optional parts?

Say, we have rule "a? b? c". Now we parse "ac" and "bc". HOW I can determine 
which optional part was specified? In 'results' array in both cases will be two 
items. Detecting by Text? No way, text can be too big and strictly speaking 
should not be involved in this procedure.
Any suggestions?

Original issue reported on code.google.com by [email protected] on 21 May 2015 at 1:35

[FR] Error format like visual studio

please, make error format like visual studio: <file>(<line>,<col>): error 
<Tool-short-name><error-number>: <error-message>
example:
UbbParser.peg(7,20): error Peg1: Expected whitespace or identifier or comment

With this error format Visual Studio allowed quick go to error place in 
peg-file.

Required changes in code:
[Serializable]
internal sealed class ParserException : Exception
{
    public ParserException()
    {
    }

    public ParserException(string message) : base(message)
    {
    }

    public ParserException(int line, int col, string file, string message) : 
    this(line, col, file, message, (Exception)null)
    {
    }

    public ParserException(int line, int col, string file, string format, params object[] args) : 
    this(line, col, file, string.Format(format, args))
    {
    }

    public ParserException(int line, int col, string file, string message, Exception inner) :
    base(message, inner)
    {
    this.Line = line;
    this.Column = col;
    this.File = file;
    }
  public readonly int? Line;
  public readonly int? Column;
  public string File;

    [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
    private ParserException(SerializationInfo info, StreamingContext context) : base(info, context)
    {
    }
}


Main:
...
if (ms_verbosity == 0)
  Console.Error.WriteLine("{0}({1},{2}): error Peg1: {3}", e.File, e.Line, e.Column, e.Message);
...

private static void DoGenerate(string pegFile)
{
    try
    {
...
    }
    catch (ParserException e)
    {
      if (e.File == null)
        e.File = pegFile;
      throw;
    }
}


Original issue reported on code.google.com by [email protected] on 20 Aug 2010 at 8:57

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.