mbdyn-lexer 0.0.2__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mbdyn_lexer-0.0.2.dist-info → mbdyn_lexer-0.0.3.dist-info}/METADATA +3 -25
- mbdyn_lexer-0.0.3.dist-info/RECORD +6 -0
- mbdyn_lexer-0.0.3.dist-info/entry_points.txt +2 -0
- src/__init__.py +0 -0
- src/mbdynlexer.py +87 -0
- mbdyn_lexer-0.0.2.dist-info/RECORD +0 -3
- {mbdyn_lexer-0.0.2.dist-info → mbdyn_lexer-0.0.3.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: mbdyn_lexer
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: Pygments Lexer Class for MBDyn Inputfiles
|
5
5
|
Project-URL: Homepage, https://gitlab.com/musipadcom/mbdyn-lexer
|
6
6
|
Project-URL: Issues, https://gitlab.com/musipadcom/mbdyn-lexer/issues
|
@@ -10,29 +10,7 @@ License-Expression: GPL-3.0-or-later
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
12
|
Requires-Python: >=3.8
|
13
|
+
Requires-Dist: pygments
|
13
14
|
Description-Content-Type: text/markdown
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
## Description
|
18
|
-
Pygments Lexer Class for MBDyn Inputfiles.
|
19
|
-
|
20
|
-
|
21
|
-
## Installation
|
22
|
-
Coming soon.
|
23
|
-
|
24
|
-
## Usage
|
25
|
-
Coming soon.
|
26
|
-
|
27
|
-
## Support
|
28
|
-
Coming soon.
|
29
|
-
|
30
|
-
## Authors and acknowledgment
|
31
|
-
Coming soon.
|
32
|
-
|
33
|
-
## License
|
34
|
-
GNU GENERAL PUBLIC LICENSE
|
35
|
-
Version 3, 29 June 2007
|
36
|
-
|
37
|
-
## Project status
|
38
|
-
Coming soon.
|
16
|
+
A Pygments lexer for MBDyn inputfiles.
|
@@ -0,0 +1,6 @@
|
|
1
|
+
src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
src/mbdynlexer.py,sha256=PR09I6vnRpwpFVsxR8TeQdyOBRIjf1h8ZB6Si3oTOBA,2388
|
3
|
+
mbdyn_lexer-0.0.3.dist-info/METADATA,sha256=1PsTbIU0UGDHMp6QGWDtZP5FnmCpRvtlDvqm00Wp3Jw,603
|
4
|
+
mbdyn_lexer-0.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
+
mbdyn_lexer-0.0.3.dist-info/entry_points.txt,sha256=bJ6_Qr5mz9_olUf2VJDgZB2tq1iS6nQC3iOSgl_fE0Q,57
|
6
|
+
mbdyn_lexer-0.0.3.dist-info/RECORD,,
|
src/__init__.py
ADDED
File without changes
|
src/mbdynlexer.py
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
'''
|
2
|
+
mbdynlexer.lexer
|
3
|
+
~~~~~~~~~~~~~~~~
|
4
|
+
|
5
|
+
Lexer for MBDyn Inputfiles.
|
6
|
+
|
7
|
+
:copyright: Copyright 2024 by Andre Zettel.
|
8
|
+
:license: GPL, see http://www.gnu.org for details.
|
9
|
+
'''
|
10
|
+
|
11
|
+
import re
|
12
|
+
|
13
|
+
from pygments.lexers.python import PythonLexer
|
14
|
+
from pygments.lexer import RegexLexer, bygroups, using, words, default, this
|
15
|
+
from pygments.token import Text, Comment, String, Name, Keyword, \
|
16
|
+
Generic, Whitespace, Operator, Punctuation, Number
|
17
|
+
|
18
|
+
__all__ = ['MBDynLexer']
|
19
|
+
|
20
|
+
|
21
|
+
class MBDynLexer(RegexLexer):
|
22
|
+
'''
|
23
|
+
For MBDyn Inputfiles
|
24
|
+
Version MultiBody Dynamics develop (So 07 Jan 2024 17∶43∶15 CET)
|
25
|
+
'''
|
26
|
+
|
27
|
+
name = 'MBDynInputFile'
|
28
|
+
url = 'http://www.aero.polimi.it/'
|
29
|
+
aliases = ['MBdyn.mbd']
|
30
|
+
filenames = ['*.mbd']
|
31
|
+
mimetypes = ['application/mbdyn']
|
32
|
+
|
33
|
+
identifier = r'[$a-zA-Z_]\w*'
|
34
|
+
|
35
|
+
_decpart = r'\d(\'?\d)*'
|
36
|
+
|
37
|
+
flags = re.DOTALL
|
38
|
+
|
39
|
+
tokens = {
|
40
|
+
'root': [
|
41
|
+
(r'\s+', Whitespace),
|
42
|
+
|
43
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
44
|
+
(r'#beginpreprocess', Comment, 'prepro'),
|
45
|
+
(r'#.*?\n', Comment.Single),
|
46
|
+
|
47
|
+
(r'[bB]egin.*?:\s*\w*\s*\w*', Generic.Heading),
|
48
|
+
(r'[eE]nd.*?:\s*\w*\s*\w*', Generic.Heading),
|
49
|
+
|
50
|
+
(r'(\w*\s*\w*\s*\w*:\s*)', Generic.Strong),
|
51
|
+
|
52
|
+
# FIXME check if this is numbers in mbdyn 2.e2 = 200
|
53
|
+
(r'(-+)?(\d(\'?\d)*\.)[eE]\d(\'?\d)*',
|
54
|
+
Number.Float),
|
55
|
+
|
56
|
+
# FIXME check if this is numbers in mbdyn 2.e-2 = 0.02
|
57
|
+
(r'(-+)?(\d(\'?\d)*\.)[eE][+-]\d(\'?\d)*',
|
58
|
+
Number.Float),
|
59
|
+
|
60
|
+
# from c_pp lexer
|
61
|
+
(r'(-+)?(\d(\'?\d)*\.\d(\'?\d)*|\.\d(\'?\d)*|\d(\'?\d)*)[eE][+-]?\d(\'?\d)*\d(\'?\d)*',
|
62
|
+
Number.Float),
|
63
|
+
|
64
|
+
# from c_pp lexer
|
65
|
+
(r'(-+)?(\d(\'?\d)*\.(\d(\'?\d)*)?|\.\d(\'?\d)*)',
|
66
|
+
Number.Float),
|
67
|
+
|
68
|
+
(r'(-+)?' + _decpart, Number.Integer),
|
69
|
+
|
70
|
+
(identifier, Name.Label),
|
71
|
+
|
72
|
+
(r'[*+=\/\-\(\)\^\]\[]', Operator),
|
73
|
+
(r'[,;]', Punctuation),
|
74
|
+
|
75
|
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
76
|
+
],
|
77
|
+
# -----------------------------------------------------------------
|
78
|
+
|
79
|
+
'comment': [
|
80
|
+
(r'[^*/]+', Comment.Multiline),
|
81
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
82
|
+
],
|
83
|
+
'prepro': [
|
84
|
+
(r'.+?(?=#endpreprocess)', using(PythonLexer), '#pop'),
|
85
|
+
],
|
86
|
+
}
|
87
|
+
|
File without changes
|