Skip to content

Commit

Permalink
Merge pull request #14 from willu47/underscore
Browse files Browse the repository at this point in the history
Allow underscores as first letter of param or set name
  • Loading branch information
willu47 authored Jun 20, 2023
2 parents 4e283da + 1b79a87 commit 47db971
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/amply/amply.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def mark_transposed(tokens):
# What follows is a Pyparsing description of the grammar

index = Word(alphanums, exact=1)
symbol = Word(alphanums, bodyChars=alphanums + "_", min=1)
symbol = Word(alphanums + "_", bodyChars=alphanums + "_", min=1)
sign = Optional(oneOf("+ -"))
integer = Combine(sign + Word(nums)).setParseAction(lambda t: int(t[0]))
number = Combine(
Expand Down
9 changes: 4 additions & 5 deletions tests/test_amply.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest

import unittest
from io import StringIO

import pytest

from amply import amply
from amply.amply import (
number,
Expand Down Expand Up @@ -79,7 +79,6 @@ def test_not_symbol(self):
0.234
+1e-049
skj!adfk
__12
"""
result = symbol.runTests(fixture, failureTests=True)
assert result[0]
Expand Down Expand Up @@ -227,7 +226,7 @@ def test_from_file(self):
try:
s = StringIO("param T:= 4;")
except TypeError:
s = StringIO(u"param T:= 4;")
s = StringIO("param T:= 4;")
assert amply.Amply.from_file(s).T == 4

def test_load_string(self):
Expand All @@ -242,7 +241,7 @@ def test_load_file(self):
try:
s = StringIO("param S := 6; param X := 1 2;")
except TypeError:
s = StringIO(u"param S := 6; param X := 1 2;")
s = StringIO("param S := 6; param X := 1 2;")
a.load_file(s)
assert a.T == 4
assert a.S == 6
Expand Down

0 comments on commit 47db971

Please sign in to comment.