Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
badw-it
DHParser
Commits
c59a4104
Commit
c59a4104
authored
May 03, 2021
by
Eckhart Arnold
Browse files
documentation extended
parent
9e1a3c46
Changes
2
Hide whitespace changes
Inline
Side-by-side
DHParser/syntaxtree.py
View file @
c59a4104
...
...
@@ -1602,7 +1602,7 @@ class Node: # (collections.abc.Sized): Base class omitted for cython-compatibil
location is the actual position within self.content (not the
source code position that the pos-attribute represents). If
the location lies out side the node's string content, `None` is
return
d
e.
returne
d
.
"""
end
=
0
for
nd
in
self
.
select_if
(
lambda
nd
:
not
nd
.
_children
,
include_root
=
True
):
...
...
@@ -2465,6 +2465,7 @@ def has_token(token_sequence: str, tokens: str) -> bool:
token sequence. If `token` itself is a blank-separated sequence of
tokens, True is returned if all tokens are contained in
`token_sequence`::
>>> has_token('bold italic', 'italic')
True
>>> has_token('bold italic', 'normal')
...
...
@@ -2482,6 +2483,7 @@ def has_token(token_sequence: str, tokens: str) -> bool:
def
add_token
(
token_sequence
:
str
,
tokens
:
str
)
->
str
:
"""Adds the tokens from 'tokens' that are not already contained in
`token_sequence` to the end of `token_sequence`::
>>> add_token('', 'italic')
'italic'
>>> add_token('bold italic', 'large')
...
...
@@ -2498,7 +2500,8 @@ def add_token(token_sequence: str, tokens: str) -> str:
def
remove_token
(
token_sequence
,
tokens
:
str
)
->
str
:
"""Removes all `tokens` from `token_sequence`::
"""
Removes all `tokens` from `token_sequence`::
>>> remove_token('red thin stroked', 'thin')
'red stroked'
...
...
@@ -2515,6 +2518,7 @@ def remove_token(token_sequence, tokens: str) -> str:
def
eq_tokens
(
token_sequence1
:
str
,
token_sequence2
:
str
)
->
bool
:
"""Returns True if bothe token sequences contain the same tokens,
no matter in what order::
>>> eq_tokens('red thin stroked', 'stroked red thin')
True
>>> eq_tokens('red thin', 'thin blue')
...
...
documentation_src/Manual.rst
View file @
c59a4104
...
...
@@ -131,8 +131,8 @@ interact with the other modules directly.
.. _lark: https://github.com/lark-parser/lark
.. _cython: https://cython.org/
.. _`language server`: https://langserver.org/
.. _`language sever protocol`: https://microsoft.github.io/language-server-protocol/
.. _`language sever protocol specification`: https://microsoft.github.io/language-server-protocol/specifications/specification-current/
.. _`language se
r
ver protocol`: https://microsoft.github.io/language-server-protocol/
.. _`language se
r
ver protocol specification`: https://microsoft.github.io/language-server-protocol/specifications/specification-current/
.. _EBNF: https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form
.. _`visitor pattern`: https://en.wikipedia.org/wiki/Visitor_pattern
.. _pypy: https://www.pypy.org/
...
...
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