• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SPF-OST / trnsys-dck-parser / 8925041585

02 May 2024 01:52PM UTC coverage: 0.0%. First build
8925041585

push

github

web-flow
Merge pull request #1 from SPF-OST/expressions

Expressions

0 of 401 new or added lines in 9 files covered. (0.0%)

0 of 401 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/trnsys_dck_parser/parse/expression/tokenize.py
NEW
1
import trnsys_dck_parser.parse.common as _pcom
×
NEW
2
import trnsys_dck_parser.parse.tokens as _ptok
×
3

4

NEW
5
class Tokens:
×
NEW
6
    POSITIVE_INTEGER = _pcom.TokenDefinition("positive integer", _ptok.Regexes.POSITIVE_INTEGER, priority=1)
×
NEW
7
    NEGATIVE_INTEGER = _pcom.TokenDefinition("integer", r"-[0-9]+", priority=2)
×
NEW
8
    FLOAT = _pcom.TokenDefinition("floating point number", r"-?[0-9]*\.[0-9]+([eE]-?[0-9]+)?", priority=3)
×
NEW
9
    LEFT_SQUARE_BRACKET = _pcom.TokenDefinition('opening square bracket ("[")', r"\[")
×
NEW
10
    RIGHT_SQUARE_BRACKET = _pcom.TokenDefinition('closing square bracket ("]")', r"\]")
×
NEW
11
    COMMA = _pcom.TokenDefinition('comma (",")', r",")
×
NEW
12
    PLUS = _pcom.TokenDefinition('plus ("+")', r"\+")
×
NEW
13
    MINUS = _pcom.TokenDefinition('minus ("-")', r"-")
×
NEW
14
    TIMES = _pcom.TokenDefinition('times ("*")', r"\*", priority=1)
×
NEW
15
    DIVIDE = _pcom.TokenDefinition('division by ("/")', r"/")
×
NEW
16
    POWER = _pcom.TokenDefinition('raise by ("**")', r"\*\*", priority=2)
×
NEW
17
    LEFT_PAREN = _pcom.TokenDefinition('opening parenthesis ("(")', r"\(")
×
NEW
18
    RIGHT_PAREN = _pcom.TokenDefinition('closing parenthesis (")")', r"\)")
×
19

20

NEW
21
def create_lexer(input_string: str) -> _pcom.Lexer:
×
NEW
22
    token_definitions = [
×
23
        Tokens.POSITIVE_INTEGER,
24
        Tokens.NEGATIVE_INTEGER,
25
        Tokens.FLOAT,
26
        Tokens.LEFT_SQUARE_BRACKET,
27
        Tokens.RIGHT_SQUARE_BRACKET,
28
        Tokens.COMMA,
29
        _ptok.Tokens.IDENTIFIER,
30
        Tokens.PLUS,
31
        Tokens.MINUS,
32
        Tokens.TIMES,
33
        Tokens.DIVIDE,
34
        Tokens.POWER,
35
        Tokens.LEFT_PAREN,
36
        Tokens.RIGHT_PAREN,
37
    ]
38

NEW
39
    return _pcom.Lexer(input_string, token_definitions)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc