Kim Gräsman [Wed, 15 Dec 2021 17:24:45 +0000 (18:24 +0100)]
Exclude known-broken pyparsing versions
We ran into the following pyparsing bug:
https://github.com/pyparsing/pyparsing/issues/345
After some bisecting it turned out it's only present in pyparsing 3.0.5-6,
and the pyparsing folks were quick to fix it for 3.0.7.
Exclude the broken versions from install_requires.
Kim Gräsman [Sun, 9 Jun 2019 13:18:27 +0000 (15:18 +0200)]
Test single value constraint for OBJECT IDENTIFIER
Kim Gräsman [Sun, 9 Jun 2019 12:51:13 +0000 (14:51 +0200)]
Make SingleValueConstraint accept alternatives
SingleValueConstraint can describe a set of valid values, not
necessarily just one.
This is not strictly correct -- the "|" token is used to create a UNION
constraint composed of multiple other constraints of different types, so
e.g. (1 | a | 6..10) is valid ASN.1, but not accepted by asn1ate.
When proper combined constraints are implemented, this should fall out
nicely and just work, but for now, support a common scenario with more
than one SingleValue.
Kim Gräsman [Sun, 9 Jun 2019 12:49:05 +0000 (14:49 +0200)]
Simpler production for INTEGER
Name the production integer_type instead of plain_integer_type.
Unique the integer type, so we don't accidentally modify the INTEGER
keyword.
Kim Gräsman [Sat, 12 May 2018 14:25:39 +0000 (16:25 +0200)]
Add --include-asn1 switch to pyasn1gen.py
This embeds the ASN.1 source into the generated Python code.
Since a Python file can contain multiple ASN.1 modules, the ASN1_SOURCES
constant is always a dict, and sources are keyed by ASN.1 module name.
Add a very basic testcase for escape chars in strings, mostly for manual
testing as we don't run any testcases with --include-asn1.
Kim Gräsman [Sun, 13 May 2018 11:34:20 +0000 (13:34 +0200)]
Emit a comment with module name before every module
Kim Gräsman [Fri, 7 Jun 2019 11:33:24 +0000 (13:33 +0200)]
Update copyright years for 2019
Norman Denayer [Tue, 16 Oct 2018 12:46:28 +0000 (14:46 +0200)]
Keep references sorted for repeatability
Using set for references guarantee uniqueness but it scrambles
them at each run (producing different outputs).
Sorting them makes the output more stable to avoid annoying
diff after a regeneration.
Norman Denayer [Tue, 16 Oct 2018 10:51:00 +0000 (12:51 +0200)]
Make the asn1ate command work again.
The asn1ate entry-point was broken in commit
dce1d3653fdad55209f8f96a83c3242a9abefe06, when an `args`
argument was added to `main`.
Wire things to make it work again.
Kim Gräsman [Sat, 12 May 2018 13:44:23 +0000 (15:44 +0200)]
Flatten main loop
Add _maybe_open which acts as a context manager for either a file
object (if a filename is provided) or sys.stdout (if '-' is provided).
This is a little weird, but makes it much clearer what's going on in
main().
Kim Gräsman [Sat, 12 May 2018 13:20:45 +0000 (15:20 +0200)]
Make scripts executable
Kim Gräsman [Sat, 12 May 2018 13:17:35 +0000 (15:17 +0200)]
Improve argument handling in test.py
* --outdir is not part of the mutually-exclusive group
* Make the action group required so either --parse, --sema or --gen must
be specified
* Pass --gen from test scripts
Kim Gräsman [Sat, 12 May 2018 13:09:48 +0000 (15:09 +0200)]
Test harness now invokes command-line driver
The test harness would reimplement the command-line driver in a simpler
form. That was nice, but would also mean that we had no test coverage
for the driver.
Turn it around so that the test harness now calls the parameterized
driver main.
No functional change intended.
Kim Gräsman [Sat, 12 May 2018 12:40:40 +0000 (14:40 +0200)]
Make sure file header is only emitted once per file
Prior to this change, in the non-split case where all modules were
generated to stdout, the header would be printed once for every module
even if they came from the same input file.
Kim Gräsman [Fri, 9 Mar 2018 22:30:41 +0000 (23:30 +0100)]
Remove unnamed type extension
This makes the grammar ambiguous for more advanced constructs.
Kim Gräsman [Fri, 9 Mar 2018 21:16:27 +0000 (22:16 +0100)]
Update all copyright years for 2018
Also harmonize copyright line format in README.txt
Kim Gräsman [Sat, 4 Nov 2017 11:09:28 +0000 (12:09 +0100)]
Bump version to 0.6.1.dev0
Kim Gräsman [Sat, 4 Nov 2017 10:50:50 +0000 (11:50 +0100)]
Bump version to 0.6.0 for release
Kim Gräsman [Sat, 4 Nov 2017 10:49:29 +0000 (11:49 +0100)]
Update tested interpreter versions
Kim Grasman [Sat, 4 Nov 2017 10:37:25 +0000 (11:37 +0100)]
Strip all trailing whitespace in test data
Kim Grasman [Sat, 4 Nov 2017 10:35:04 +0000 (11:35 +0100)]
Describe use of asn1ate as a library
Also add a caveat on API stability, of which there is currently none.
Kim Grasman [Fri, 4 Aug 2017 17:54:56 +0000 (19:54 +0200)]
Maintain ModuleReference in DefinedType
... instead of just name.
Kim Grasman [Fri, 4 Aug 2017 17:49:21 +0000 (19:49 +0200)]
Use module_ref for ModuleReference fields
Kim Grasman [Fri, 4 Aug 2017 17:37:42 +0000 (19:37 +0200)]
Make module references first-class sema nodes
Both ModuleReference and GlobalModuleReference are now proper sema
nodes. This is in preparation for only generating imports of modules
whose types are used.
Kim Grasman [Fri, 4 Aug 2017 15:17:50 +0000 (17:17 +0200)]
Sema support for IMPORTS
Kim Grasman [Fri, 4 Aug 2017 13:22:06 +0000 (15:22 +0200)]
Parse all IMPORTS clauses
I think this covers all variations.
Kim Grasman [Thu, 3 Aug 2017 15:36:29 +0000 (17:36 +0200)]
Allow empty symbol list for EXPORTS
Add better test coverage in exports.asn
Kim Grasman [Thu, 3 Aug 2017 13:34:43 +0000 (15:34 +0200)]
Support EXPORTS for modules
Parse and wire up a sema node for EXPORTS and its associated symbol
names.
As far as I can tell, this supports all valid EXPORTS.
Kim Grasman [Thu, 3 Aug 2017 12:58:04 +0000 (14:58 +0200)]
Properly module-qualify type references in sema
Kim Grasman [Thu, 3 Aug 2017 12:48:41 +0000 (14:48 +0200)]
Allow external value references
When value-reference expressions are generated, include the
Python-sanitized module name, unless it denotes the current module.
This is still untested with proper cross-module references.
Kim Grasman [Wed, 2 Aug 2017 10:46:39 +0000 (12:46 +0200)]
Test runner now supports multi-modules
Instead of piping text to python, we now write out all modules in an
.asn file to individual Python scripts under _testdir/. The basic_test
scripts create and remove the test directory, and check that all files
in the directory are valid Python modules.
This uncovered a couple of bugs with value references, so temporarily
disable these tests.
Note basic_test.bat is untested, I no longer have a Windows rig for
testing.
Kim Grasman [Tue, 1 Aug 2017 19:09:49 +0000 (21:09 +0200)]
Unix line endings for everything but bat files
Kim Grasman [Tue, 1 Aug 2017 18:54:51 +0000 (20:54 +0200)]
Update copyright years
Kim Grasman [Sun, 11 Sep 2016 10:14:57 +0000 (12:14 +0200)]
Codegen for SET OF inline size constraints
Sparked by the earlier report for SEQUENCE OF by @aholtzma.
Aaron Holtzman [Thu, 8 Sep 2016 21:15:17 +0000 (17:15 -0400)]
Codegen for inline SEQUENCE OF
This fixes issue #42.
Original patch by @aholtzma, adjusted and squashed by me.
Kim Grasman [Thu, 8 Sep 2016 19:34:45 +0000 (21:34 +0200)]
Bump copyright years to 2016
Quick before the year ends!
Kim Grasman [Thu, 8 Sep 2016 19:03:33 +0000 (21:03 +0200)]
Support empty component types
This fixes issue #34.
Kim Grasman [Thu, 8 Sep 2016 18:45:04 +0000 (20:45 +0200)]
Fix bug with stringization of auto-tagged types
The assumption is that the class-spec only contains strings. The
automatic tagging broke that invariant by throwing in an int as class
number.
Found by @aholtzma, thanks!
Kim Grasman [Thu, 8 Sep 2016 18:48:14 +0000 (20:48 +0200)]
Wrap some long lines
No functional change.
Kim Grasman [Mon, 22 Aug 2016 19:40:37 +0000 (21:40 +0200)]
Simplify pip requirements
Based on the wisdom in https://caremad.io/2013/07/setup-vs-requirement/,
this removes dev-requirements.txt in favor using setup.py via -e.
Kim Grasman [Mon, 22 Aug 2016 19:07:23 +0000 (21:07 +0200)]
Remove last traces of 'implicity'
This is a breaking change for out-of-tree consumers of sema.
Ilya Etingof [Sun, 14 Aug 2016 12:08:45 +0000 (14:08 +0200)]
Code linted and PEP8'ed
Original patch from Ilya Etingof, squashed by me.
unknown [Tue, 2 Feb 2016 20:40:13 +0000 (21:40 +0100)]
More repeatable header for autogenerated files
We now include asn1ate version, source filename and last-modified time
of source file.
This makes output repeatable for the same inputs.
unknown [Tue, 2 Feb 2016 20:31:48 +0000 (21:31 +0100)]
Add version available at runtime
asn1ate.__version__ will now contain the package version.
setup.py pulls it from there with a technique described in:
http://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
Michael Mattice [Fri, 29 Jan 2016 20:00:49 +0000 (14:00 -0600)]
Sort assignments by name to make output repeatable
Patch by Mike Mattice, thanks!
Kim Grasman [Tue, 22 Dec 2015 09:37:31 +0000 (10:37 +0100)]
Update test.py to match changed pyasn1gen.
Kim Gräsman [Tue, 22 Dec 2015 09:11:56 +0000 (10:11 +0100)]
Merge pull request #29 from james-ward/sema-autotag
Add support for AUTOMATIC TAGS.
Patch by James Ward, thanks!
Kim Grasman [Mon, 21 Dec 2015 05:45:37 +0000 (06:45 +0100)]
Remove outdated TODO
Kim Gräsman [Sat, 19 Dec 2015 15:25:39 +0000 (16:25 +0100)]
Merge pull request #28 from viraptor/extra_strings
Add more string types
Patch by Stanisław Pitucha, thanks!
Kim Gräsman [Sat, 19 Dec 2015 15:24:21 +0000 (16:24 +0100)]
Merge pull request #25 from viraptor/proper_setup
Install script and dependencies
Patch by Stanisław Pitucha, thanks!
Stanisław Pitucha [Fri, 18 Dec 2015 04:58:06 +0000 (15:58 +1100)]
Add more string types
Fixes issue #27
Stanisław Pitucha [Thu, 17 Dec 2015 03:25:16 +0000 (14:25 +1100)]
Install script and dependencies
Make sure that `pip install` installs both the pyasn1gen script and pyparsing
automatically.
Kim Gräsman [Sun, 22 Nov 2015 17:06:36 +0000 (18:06 +0100)]
Merge pull request #23 from james-ward/choice-tag
Tagged CHOICEs must always be explicit.
Patch by James Ward.
Kim Gräsman [Sun, 22 Nov 2015 17:05:21 +0000 (18:05 +0100)]
Merge pull request #21 from james-ward/multi-module
Allow multi-module processing.
Patch by James Ward.
James Ward [Tue, 6 Oct 2015 23:02:09 +0000 (10:02 +1100)]
Add automatic tags.
ConstructedTypes now have a method to autotag their components.
This will wrap all components in a TaggedType with incrementing
tag number, but only if no components are already tagged (as per
the ASN.1 specification).
After generating the module(s) this method is called on all
ConstructedTypes in the tree if the module's tag default is
AUTOMATIC.
Ignore ExtensionMarkers when autotagging.
Resolves #20.
James Ward [Tue, 8 Sep 2015 10:22:27 +0000 (20:22 +1000)]
Allow multi-module processing.
When generating code, the list of modules is passed through Pyasn1Backend
in order to allow references across modules. Modules in this list
are also added to the output as import statements.
The main function in pyasn1gen.py has been modified to take a command
line switch to output multiple modules to separate files rather than
stdout.
James Ward [Mon, 5 Oct 2015 23:28:22 +0000 (10:28 +1100)]
Tagged CHOICEs must be explicit if the default is implicit, automatic or empty.
Resolves issue #23.
Kim Grasman [Thu, 11 Jun 2015 20:19:54 +0000 (22:19 +0200)]
Set dev version.
Kim Grasman [Thu, 11 Jun 2015 20:17:33 +0000 (22:17 +0200)]
Fix issue #18: VisibleString bug
Add builtin mapping from VisibleString to char.VisibleString.
Test case from Wireshark's source tree.
Kim Grasman [Sun, 15 Mar 2015 09:38:37 +0000 (10:38 +0100)]
Bump to unique dev version.
Kim Grasman [Sat, 14 Mar 2015 15:35:33 +0000 (16:35 +0100)]
Update copyright years.
Kim Grasman [Sat, 14 Mar 2015 15:31:52 +0000 (16:31 +0100)]
Reformat and add short blurb on tested Python versions.
Kim Grasman [Sat, 14 Mar 2015 15:28:30 +0000 (16:28 +0100)]
Bump version to 0.5 to prepare for release.
Kim Grasman [Sat, 14 Mar 2015 15:28:09 +0000 (16:28 +0100)]
Add pip requirements files.
Kim Grasman [Sun, 1 Feb 2015 19:54:33 +0000 (20:54 +0100)]
Merge branch 'master' of https://github.com/kimgr/asn1ate
Kim Grasman [Sun, 1 Feb 2015 19:50:46 +0000 (20:50 +0100)]
Fix issue 11: respect module tag defaults.
Simplify parser (leave None tokens for missing tag implicity.)
Record module tag defaults in sema.
Use module tag defaults if tag implicity is missing.
Kim Grasman [Sun, 1 Feb 2015 14:48:22 +0000 (15:48 +0100)]
Rename Huawei CDR testdata.
Kim Gräsman [Sat, 13 Dec 2014 22:28:07 +0000 (23:28 +0100)]
Merge pull request #16 from fzonneveld/issue15_BIT_STRING_in_SEQUENCE_fails
Fixed issue 15, BIT STRING in constructed types
Frank Zonneveld [Sat, 13 Dec 2014 20:52:47 +0000 (15:52 -0500)]
Fixed issue 15, BIT STRING in constructed types
Added the BIT STRING type into the inline generator
part for constructed types.
Added small update in SEQUENCE test.
Kim Grasman [Mon, 10 Nov 2014 21:01:31 +0000 (22:01 +0100)]
Fix issue 10.
Parse SIZE constraints on defined types.
Support GraphicString.
Add public test data file for Huawie call charging.
Kim Grasman [Sat, 1 Nov 2014 14:46:23 +0000 (15:46 +0100)]
Inline any_defined_by clause and trim whitespace in test data.
Frank Zonneveld [Tue, 28 Oct 2014 19:21:43 +0000 (15:21 -0400)]
Added ANY type.
Kim Grasman [Sun, 27 Jul 2014 12:32:21 +0000 (14:32 +0200)]
Support for selection types.
Kim Grasman [Sun, 27 Jul 2014 08:12:23 +0000 (10:12 +0200)]
Fix issue #1: All constraints are now code-genned.
Kim Grasman [Sat, 26 Jul 2014 20:39:41 +0000 (22:39 +0200)]
Correctly construct univ.BitString from bstring/hstring types.
Kim Grasman [Sat, 26 Jul 2014 20:33:25 +0000 (22:33 +0200)]
Fix bug where self.constraint was sometimes never set.
Kim Grasman [Sat, 26 Jul 2014 19:28:26 +0000 (21:28 +0200)]
Tests for OCTET STRING values.
Kim Grasman [Sat, 26 Jul 2014 14:17:10 +0000 (16:17 +0200)]
Use Optional instead of empty.
Kim Grasman [Sat, 26 Jul 2014 14:14:35 +0000 (16:14 +0200)]
Switch exponent rule to use CaselessLiteral.
Kim Grasman [Sat, 26 Jul 2014 14:05:17 +0000 (16:05 +0200)]
Remove redundant constraint rule.
Kim Grasman [Sat, 26 Jul 2014 13:58:03 +0000 (15:58 +0200)]
Force Unix line endings.
Kim Grasman [Sat, 26 Jul 2014 13:57:50 +0000 (15:57 +0200)]
Support value-range and single-value constraints for REAL
Kim Grasman [Sat, 26 Jul 2014 13:38:15 +0000 (15:38 +0200)]
Remove scary comment.
Kim Grasman [Sat, 26 Jul 2014 12:52:04 +0000 (14:52 +0200)]
Proper grammar for REAL values.
Including support for exponent values.
Kim Grasman [Sat, 26 Jul 2014 09:18:14 +0000 (11:18 +0200)]
Fix so size constraints generate ValueSizeConstraint instead of ValueRangeConstraint.
Kim Grasman [Sat, 26 Jul 2014 09:14:47 +0000 (11:14 +0200)]
Only generate _OID helper if necessary.
Kim Grasman [Sat, 26 Jul 2014 08:50:26 +0000 (10:50 +0200)]
Support BIT STRING types without enumerators.
Found the lovely Optional(..., default=) construct.
Kim Grasman [Fri, 25 Jul 2014 16:53:28 +0000 (18:53 +0200)]
Fix bugs in name translation.
Kim Grasman [Fri, 25 Jul 2014 16:29:12 +0000 (18:29 +0200)]
Better type and value name sanitization.
Kim Grasman [Fri, 25 Jul 2014 15:03:37 +0000 (17:03 +0200)]
Support size and single-value constraints on some types.
Kim Grasman [Fri, 25 Jul 2014 09:40:04 +0000 (11:40 +0200)]
Parse and ignore external value references.
Kim Grasman [Fri, 25 Jul 2014 09:36:17 +0000 (11:36 +0200)]
Parse and ignore external type references.
Kim Grasman [Thu, 24 Jul 2014 14:17:04 +0000 (16:17 +0200)]
Add new public standard definition.
Vehicle-to-vehicle distributed short-range communications.
Kim Grasman [Thu, 24 Jul 2014 13:58:33 +0000 (15:58 +0200)]
Test case for circular assignment dependencies.
Kim Grasman [Tue, 22 Jul 2014 20:38:44 +0000 (22:38 +0200)]
Fix issue #8 -- Cyclic references.
We can now have cyclic references between assignments and constructed type
members. This required extensive surgery to properly handle cycles in
dependency sorting and to generate assignment code in two passes.
Kim Grasman [Mon, 2 Jun 2014 18:59:36 +0000 (20:59 +0200)]
Add batch file for PyPI publishing.
Kim Grasman [Mon, 2 Jun 2014 18:45:41 +0000 (20:45 +0200)]
Add classifiers and bump version.
Kim Grasman [Mon, 2 Jun 2014 18:11:44 +0000 (20:11 +0200)]
Rename README.rst -> README.txt
Follows Python packaging convention at the expense of Github reST formatting. Oh well.
Kim Grasman [Mon, 2 Jun 2014 18:07:40 +0000 (20:07 +0200)]
Add explicit source file encoding to setup.py.
Re-save it with UTF-8 encoding, so my name does not come out garbled.
Kim Gräsman [Mon, 14 Apr 2014 18:55:23 +0000 (20:55 +0200)]
Merge pull request #7 from rasky/master
Add support for ENUMERATED in identifier-only form. Patch by Giovanni Bajo!