From c85fddf0e5f9bf090ef18f75220588c5bfa6a809 Mon Sep 17 00:00:00 2001 From: Alan Post Date: Tue, 27 Feb 2024 15:35:33 -0600 Subject: [PATCH] add missing annotation in tutorial, typo and whitespace cleanup (#334) The mini tutorial, when introducing grammar annotation, failed to add annotate the division expression. s/alfanumeric/alphanumeric/ along with s/alfarnumeric/alphanumeric/ in the directives documentation. Remove whitespace between @ or @@ and the directive when discussing reserved word handling in the syntax documentation, consistent with how directives are formatted elsewhere. Co-authored-by: Alan Post --- docs/directives.rst | 4 ++-- docs/mini-tutorial.rst | 4 ++-- docs/syntax.rst | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/directives.rst b/docs/directives.rst index e255c37b..82852984 100644 --- a/docs/directives.rst +++ b/docs/directives.rst @@ -71,7 +71,7 @@ Enables left-recursive rules in the grammar. See the `Left Recursion`_ sections ``@@namechars :: `` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -A list of (non-alfanumeric) characters that should be considered part of names when using the `@@nameguard`_ feature: +A list of (non-alphanumeric) characters that should be considered part of names when using the `@@nameguard`_ feature: .. code:: @@ -83,7 +83,7 @@ A list of (non-alfanumeric) characters that should be considered part of names w ``@@nameguard :: `` ~~~~~~~~~~~~~~~~~~~~~~~~~ -When set to ``True``, avoids matching tokens when the next character in the input sequence is alfarnumeric or a ``@@namechar``. Defaults to ``True``. See the `'text' expression`_ for an explanation. +When set to ``True``, avoids matching tokens when the next character in the input sequence is alphanumeric or a ``@@namechar``. Defaults to ``True``. See the `'text' expression`_ for an explanation. .. code:: diff --git a/docs/mini-tutorial.rst b/docs/mini-tutorial.rst index ea1412d6..700d8b3a 100644 --- a/docs/mini-tutorial.rst +++ b/docs/mini-tutorial.rst @@ -382,7 +382,7 @@ Having semantic actions determine what was parsed with ``isinstance()`` or query division = - left:term '/' ~ right:factor + left:term op:'/' ~ right:factor ; @@ -511,7 +511,7 @@ The first step to create an object model is to annotate the rule names with the division::Divide = - left:factor '/' ~ right:term + left:factor op:'/' ~ right:term ; diff --git a/docs/syntax.rst b/docs/syntax.rst index 7204e274..1a5ad10c 100644 --- a/docs/syntax.rst +++ b/docs/syntax.rst @@ -771,16 +771,16 @@ the language. Those reserved tokens are known as `Reserved Words`_ or `Keywords`_ |TatSu| provides support for preventing the use of `keywords`_ as -identifiers though the ``@@ keyword`` directive,and the ``@ name`` +identifiers though the ``@@keyword`` directive,and the ``@name`` decorator. A grammar may specify reserved tokens providing a list of them in one or -more ``@@ keyword`` directives:: +more ``@@keyword`` directives:: @@keyword :: if endif @@keyword :: else elseif -The ``@ name`` decorator checks that the result of a grammar rule does +The ``@name`` decorator checks that the result of a grammar rule does not match a token defined as a `keyword`_:: @name