Commits

Anonymous committed 3f8aacd

adding glossary YML function

  • Participants
  • Parent commits 3743263

Comments (0)

Files changed (3)

File docs/grammar_elements.en.yhtml2

         ƒpyPEG predefines different RegEx objects:
         >>
 
-    table border=1 {
-        tr {
-            td p code > word = re.compile(r"\w+")
-            td p > Regular expression for scanning a word.
-        }
-
-        tr {
-            td p code > restline = re.compile(r".*")
-            td p > Regular expression for rest of line.
-        }
-
-        tr {
-            td p code > whitespace = re.compile("(?m)\s+")
-            td p > Regular expression for scanning whitespace.
-        }
+    glossary {
+        term 'word = re.compile(r"\w+")' > Regular expression for scanning a word.
+        term 'restline = re.compile(r".*")' > Regular expression for rest of line.
+        term 'whitespace = re.compile("(?m)\s+")'
+            > Regular expression for scanning whitespace.
+        term 'comment_sh  = re.compile(r"\#.*")' > Shell script style comment.
+        term 'comment_cpp = re.compile(r"//.*")' > C++ style comment.
+        term 'comment_c   = re.compile(r"(?m)/\*.*?\*/")'
+            > C style comment without nesting comments.
+        term 'comment_pas = re.compile(r"(?m)\(\*.*?\*\)")'
+            > Pascal style comment without nesting comments.
     }
 
     p > Example:
 
     p > which is equivalent. There are special cardinality values:
 
-    table border=1 {
-        tr {
-            td p code > -2, thing
-            td p > «some(thing)»; this represents the plus cardinality, +
-        }
-        tr {
-            td p code > -1, thing
-            td p > «maybe_some(thing)»; this represents the asterisk cardinality, *
-        }
-        tr {
-            td p code > 0, thing
-            td p > «optional(thing)»; this represents the question mark cardinality, ?
-        }
+    glossary {
+        term "-2, thing" > «some(thing)»; this represents the plus cardinality, +
+        term "-1, thing" > «maybe_some(thing)»; this represents the asterisk cardinality, *
+        term "0, thing" > «optional(thing)»; this represents the question mark cardinality, ?
     }
 
     p   >>
         '23'
         ||
 
+    h3 id=none > Constant «None»
+
+    p   >>
+        «None» parses to nothing. And it composes to nothing. It represents
+        the no-operation value.
+        >>
+
     h2 id=goclasses > Grammar Element Classes
 
     h3 id=symbol > Class «Symbol(str)»
 
     h4 > Class variables
 
-    table border=1 {
-        tr {
-            td p code > regex
-            td p > regular expression to scan, default «re.compile(r"\w+")»
-        }
-        tr {
-            td p code > check_keywords
-            td p > flag if a «Symbol» has to be checked for not being a «Keyword»; default: «False»
-        }
+    glossary {
+        term "regex" > regular expression to scan, default «re.compile(r"\w+")»
+        term "check_keywords"
+            > flag if a «Symbol» has to be checked for not being a «Keyword»; default: «False»
     }
 
     h4 > Instance variables
 
-    table border=1 {
-        tr {
-            td p code > name
-            td p > name of the «Keyword» as «str» instance
-        }
-    }
+    glossary
+        term "name" > name of the «Keyword» as «str» instance
 
     h4 > Method «__init__(self, name, namespace=None)»
 
 
     h5 > Raises:
 
-    table border=1 {
-        tr {
-            td p code > ValueError
-            td p > if «check_keywords» is «True» and value is identical to a «Keyword»
-        }
-
-        tr {
-            td p code > TypeError
-            td p > if «namespace» is given and not an instance of «Namespace»
-        }
+    glossary {
+        term "ValueError"
+            > if «check_keywords» is «True» and value is identical to a «Keyword»
+        term "TypeError"
+            > if «namespace» is given and not an instance of «Namespace»
     }
 
     h4 > Parsing
 
     h4 > Class variables
 
-    table border=1 {
-        tr {
-            td p code > regex
-            td p > regular expression to scan; default «re.compile(r"\w+")»
-        }
-        tr {
-            td p code > table
-            td p > «Namespace» with keyword table
-        }
+    glossary {
+        term "regex" > regular expression to scan; default «re.compile(r"\w+")»
+        term "table" > «Namespace» with keyword table
     }
 
     h4 > Instance variables
 
-    table border=1 {
-        tr {
-            td p code > name
-            td p > name of the «Keyword» as «str» instance
-        }
-    }
+    glossary
+        term "name" > name of the «Keyword» as «str» instance
 
     h4 > Method «__init__(self, keyword)»
 
 
     h4 > Instance variables
 
-    table border=1 {
-        tr {
-            td p code > Class
-            td p > reference to «Attribute» class generated by «namedtuple()»
-        }
-    }
+    glossary
+        term "Class" > reference to «Attribute» class generated by «namedtuple()»
 
     h4 > Parsing
 

File docs/heading.en.yinc2

 decl mark(class="mark") alias span;
 decl Mark(class="mark") alias div;
 
+decl term(*term) alias tr {
+    td p code *term;
+    td p content;
+};
+
+decl glossary(border=1) alias table;
+
 decl ne is a {
     content;
     br;

File docs/parser_engine.en.yhtml2

     h3 id=parser > Class «Parser»
 
     p   >>
-        Offers parsing and composing capabilities. Implements a ∫Packrat parser∫.
+        Offers parsing and composing capabilities. Implements an intrinsic
+        ∫Packrat parser∫.
         >>
     
     h4 > Instance variables
 
-    table border=1 {
-        tr {
-            td p code > whitespace
-            td p    >>
-                    regular expression to scan whitespace; default:
-                    «re.compile("(?m)\s+")»
-                    >>
-        }
-        tr {
-            td p code > comment
-            td p > «grammar» to parse comments
-        }
-        tr {
-            td p code > last_error
-            td p > «SyntaxError» which ended parsing
-        }
-        tr {
-            td p code > indent
-            td p    >>
-                    string to use to indent while composing; default: four
-                    spaces «"    "»
-                    >>
-        }
-        tr {
-            td p code > indention_level
-            td p > level to indent to; default: «0»
-        }
+    p   >>
+        The instance variables are representing the parser's state.
+        >>
 
-        tr {
-            td p code > text
-            td p > original text to parse; set for decorated syntax errors
-        }
-        tr {
-            td p code > filename
-            td p > filename where text is origin from
-        }
+    glossary {
+        term "whitespace"
+            > regular expression to scan whitespace; default: «re.compile(r"(?m)\s+")»
+        term "comment" > «grammar» to parse comments; default: «None»
+        term "last_error" > after parsing, «SyntaxError» which ended parsing
+        term "indent" > string to use to indent while composing; default: four spaces
+        term "indention_level" > level to indent to; default: «0»
+        term "text" > original text to parse; set for decorated syntax errors
+        term "filename" > filename where text is origin from
     }
 }