diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-03-04 14:48:44 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-03-04 14:48:44 +0100 |
commit | 11c6272abc2b34d861620b906bdee595674dca0f (patch) | |
tree | 3c5568c0653ade15d6f56078eb216418f0dade29 /src/core/model/Syntax.hpp | |
parent | d6d08ae2dfc31c583f172c74ef9e19b203776107 (diff) | |
parent | 2714f95ab3c8632686d24ff8d2abfc1f35dc5dd7 (diff) |
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'src/core/model/Syntax.hpp')
-rw-r--r-- | src/core/model/Syntax.hpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/core/model/Syntax.hpp b/src/core/model/Syntax.hpp index 4da3408..4adb329 100644 --- a/src/core/model/Syntax.hpp +++ b/src/core/model/Syntax.hpp @@ -74,6 +74,15 @@ struct TokenDescriptor { * @return true if and only if neither a string nor an ID is given. */ bool isEmpty() const { return token.empty() && id == Tokens::Empty; } + + /** + * Returns true if the token is valid, which is the case if this class is + * either marked as special token or is empty or does have a valid token + * string set. + * + * @return true if the token descriptor is valid, false otherwise. + */ + bool isValid() const; }; /** @@ -86,17 +95,17 @@ struct TokenDescriptor { */ struct SyntaxDescriptor { /** - * Possible start token or Tokens::Empty if no token is set. + * Possible open token or Tokens::Empty if no token is set. */ - TokenId start; + TokenId open; /** - * Possible end token or Tokens::Empty if no token is set. + * Possible close token or Tokens::Empty if no token is set. */ - TokenId end; + TokenId close; /** - * Possible representation token or Tokens::Empty if no token is set. + * Possible short form token or Tokens::Empty if no token is set. */ TokenId shortForm; @@ -118,8 +127,8 @@ struct SyntaxDescriptor { * descriptor handle to nullptr. */ SyntaxDescriptor() - : start(Tokens::Empty), - end(Tokens::Empty), + : open(Tokens::Empty), + close(Tokens::Empty), shortForm(Tokens::Empty), descriptor(nullptr), depth(-1) @@ -129,18 +138,18 @@ struct SyntaxDescriptor { /** * Member initializer constructor. * - * @param start is a possible start token. - * @param end is a possible end token. + * @param open is a possible open token. + * @param close is a possible close token. * @param shortForm is a possible short form token. * @param descriptor The Descriptor this SyntaxDescriptor belongs to. * @param depth Given the current leaf in the parsed document the depth of a * SyntaxDescriptor is defined as the number of transparent elements that * would be needed to construct an instance of the referenced descriptor. */ - SyntaxDescriptor(TokenId start, TokenId end, TokenId shortForm, + SyntaxDescriptor(TokenId open, TokenId close, TokenId shortForm, Handle<Node> descriptor, ssize_t depth) - : start(start), - end(end), + : open(open), + close(close), shortForm(shortForm), descriptor(descriptor), depth(depth) @@ -193,4 +202,4 @@ struct SyntaxDescriptor { bool isEmpty() const; }; } -#endif
\ No newline at end of file +#endif |