Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
655892e4
Commit
655892e4
authored
5 months ago
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a comment describing the parser
parent
8d09a0d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
sql/simple_parser.h
sql/simple_parser.h
+32
-0
No files found.
sql/simple_parser.h
View file @
655892e4
...
...
@@ -21,6 +21,38 @@
#include "simple_tokenizer.h"
/*
A set of templates for constructing a recursive-descent LL(1) parser.
One is supposed to define classes corresponding to grammar productions.
The class should inherit from the grammar rule template. For example, a
grammar rule
foo := bar, baz
is implemented with
class Bar ... ; // "bar" is parsed into Bar object
class Baz ... ; // "baz" is parsed into Baz object
// "foo" is parsed into a Foo object.
class Foo: public Parser_templates::AND2<PARSER, Bar, Baz> {
using AND2::AND2;
...
};
Inheriting AND2's constructors with "using" will generate the parsing code.
Parsing is done by constructing parser output from the parser object:
Foo parsed_output(parser);
All parser objects should also have
- A capability to construct an "empty" or "invalid" object with constructor
that accepts no arguments. This is necessary when parsing fails.
- operator bool() which returns true if the object is valid/non-empty and
false if otherwise.
*/
class
Parser_templates
{
protected:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment