class TaskJuggler::TextParser

The TextParser implements a somewhat modified LL(1) parser. It uses a dynamically compiled state machine. Dynamically means, that the syntax can be extended during the parse process. This allows support for languages that can extend their syntax during the parse process. The TaskJuggler syntax is such an beast.

This class is just a base class. A complete parser would derive from this class and implement the rule set and the functions _nextToken()_ and _returnToken()_. It also needs to set the array variables to declare all variables ($SOMENAME) that the scanner may deliver.

To describe the syntax the functions TextParser#pattern, TextParser#optional and TextParser#repeatable can be used. When the rule set is changed during parsing, TextParser#updateParserTables must be called to make the changes effective. The parser can also document the syntax automatically. To document a pattern, the functions TextParser#doc, TextParser#descr, TextParser#also and TextParser#arg can be used.

In contrast to conventional LL grammars, we use a slightly improved syntax descriptions. Repeated patterns are not described by recursive call but we use a repeat flag for syntax rules that consists of repeatable patterns. This removes the need for recursion elimination when compiling the state machine and makes the syntax a lot more readable. However, it adds a bit more complexity to the state machine. Optional patterns are described by a rule flag, not by adding an empty pattern.

To start parsing the input the function TextParser#parse needs to be called with the name of the start rule.

MacroTable.rb – The TaskJuggler III Project Management Software

Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014

by Chris Schlaeger <cs@taskjuggler.org>

This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

StackElement.rb – The TaskJuggler III Project Management Software

Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014

by Chris Schlaeger <cs@taskjuggler.org>

This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

State.rb – The TaskJuggler III Project Management Software

Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014

by Chris Schlaeger <cs@taskjuggler.org>

This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.

TokenDoc.rb – The TaskJuggler III Project Management Software

Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014

by Chris Schlaeger <cs@taskjuggler.org>

This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation.