Skip to content

Releases: klauer/blark

v0.8.1

21 Nov 23:17
Compare
Choose a tag to compare

This is a packaging bugfix release.

For details about v0.8.0, see here.

Full Changelog: v0.8.0...v0.8.1

v0.8.0

21 Nov 22:27
4d5c905
Compare
Choose a tag to compare

What's Changed

  • Fixed support for function call chaining in general expressions beyond just statements (#93 / #94)
  • Fixed support for indirect specifications with initialization parameters (e.g., POINTER TO FB_Something(1, 2)) (#85, #95)
  • Some initial API documentation is now available on GitHub Pages
    • All transformer (lark grammar -> AST-like) dataclasses now have docstrings and examples (#89)
    • Dataclass documentation shows the associated Lark grammar rule(s)
  • Fixed incorrect escape character for double quotes in double-byte strings ($" #86)
  • The prototype Sphinx domain is returns to being functional post-solution-loading refactor (#87)
  • Comment pre-parsing will now include positional metadata (#89)
  • Preliminary supporting for annotating source code with HTML/XML tags (stylesheets not included) (#88)
    • Example: blark format --output-format html FB_ProjectA.TcPOU
  • More test coverage of the grammar and related tools

Grammar

  • Added chained_function_call grammar rule (ChainedFunctionCall dataclass)
  • Some unused rules and terminals - vestiges of old blark functionality - were removed
    • structured_var_declaration, function_var_decl, step_*
  • Added chained_function_call
    • chained_function_call_statement now uses chained_function_call

Pull Requests

  • Unused grammar rule clean-up and grammar coverage tests by @klauer in #86
  • FIX: make sphinx domain work again by @klauer in #87
  • ENH/DOC: docstrings + start of API docs by @klauer in #89
  • ENH: first pass at html output by @klauer in #88
  • CI: documentation deployment GitHub Action by @klauer in #92
  • FIX: function call chaining in expressions by @klauer in #94
  • FIX: init arguments for pointer type specifications by @klauer in #95

Full Changelog: v0.7.1...v0.8.0

v0.7.1

18 Sep 18:36
16498b7
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.7.0...v0.7.1

v0.7.0

16 Aug 18:13
3e1a543
Compare
Choose a tag to compare

What's Changed

This release includes a major rework of TwinCAT solution file loading, the blark CLI tool, and a number of grammar-related fixes.

  • INTERFACE definitions are now supported. (#73) The solution loader can load these .TcIO files directly.
  • Add support for the JMP statement (#79)
  • Grammar fixes for the following:
    • Arrays of arrays in type declarations and initialization (e.g., fValue : ARRAY [1..10] OF ARRAY [1..10] OF INT;) (#66)
    • Code with identifiers starting with Return or Continue will no longer be mistaken for statements of the same name (#68)
    • String lengths may now be expressions (e.g., STRING(g_Constant + 1) := 'abc') (#72)
    • Expressions in initial array elements are no longer limited to constants (e.g., currentChannel : ARRAY[1..g_c_someConstant] OF POINTER TO struct_groupData := [ ADR(_object[1].someValue) ];) (#74)
    • Removed support for power expression (**) which is invalid in TwinCAT-flavor ST (#76)
  • A new TwinCAT solution loader (.sln, .tsproj, .TcPOU, etc.) was added to blark with a goal of making file loading more easily customizable, with the option to load/save arbitrary file formats. (#64)
    • The implementation is preliminary and subject to change (as is everything in blark).
    • blark continues to support the current input formats (plain text .st files, and TwinCAT source code files)
    • Removed the dependency on pytmc (for code loading, the dependency store, and everything else).
    • New requirement, lxml, for project parsing.
    • Allow for mapping of blark input line numbers back to source code files. Input files may now correspond to one or more different grammar rules (e.g., a TcPOU FUNCTION_BLOCK that contains declaration, an implementation, and any number of METHOD / ACTION / PROPERTY sub-items).
    • Allow for in-place code rewriting of source code files (blark format --write my_pou.TcPOU)
  • Rework of user-facing parsing API to use a consistent dataclass. (#64)
    • This groups together the source code, a map of line numbers, the raw lark.Tree, and an option to easily transform it into blark.transform dataclasses to allow for code rewriting, reformatting, summarization, and so on.
  • Rework of the blark parse CLI. See blark parse --help for more details.
  • Rework of the blark format CLI to support the new input/output file handling. See blark format --help for more details.

Pull Requests

  • Support arrays of arrays by @engineerjoe440 in #66
  • Resolve RETURN and CONTINUE Overly-Greedy Matching by @engineerjoe440 in #68
  • FIX: string length expression by @klauer in #72
  • REF/ENH: standalone solution parser and rewrite of input/output format support by @klauer in #64
  • FIX/CLN: remove unsupported power_expression by @klauer in #76
  • FIX: Bugfix for expressions in initial array elements by @klauer in #74
  • ENH: interface support by @klauer in #73
  • ENH: first pass at JMP and labeled statements by @klauer in #79
  • FIX: ignore global text list project files by @klauer in #81

Full Changelog: v0.6.0...v0.7.0

v0.6.0

19 Apr 20:46
4ea1ea0
Compare
Choose a tag to compare

What's Changed

This release includes a number of small-but-important grammar fixes.

  • Fixed support for explicit base 10 integer literals (e.g., 10#12345)
  • Added an explicit CONTINUE statement. This erroneously parsed as a no-op statement previously.
  • Added support of chained function-call/method-call statements with new function_call_statement_list grammar.
  • Added optional dereference (^) character to function and method calls (e.g., uut.call1()^.call2())
  • Removed method_statement to reduce ambiguity, since method_statement is a subset of functional_call_statement
  • Add support for array initializer for function_block objects. (Example)
  • Enhanced function_block declaration to support setting structured attributes (VAR_INPUT and VAR_IN_OUT).

Pull Requests

Full Changelog: v0.5.0...v0.6.0

v0.5.0

28 May 00:12
61684c9
Compare
Choose a tag to compare

What's Changed

  • Enhancement/support recursive pointer to by @engineerjoe440 in #33
  • Bugfix/Enhancement: Add Support of bit_string_literal in CASE Statements by @engineerjoe440 in #35
  • Enhancements and Fixes Found While Testing Code Base by @engineerjoe440 in #36
    • Add Support of VAR_EXTERNAL in Functions
    • Allow DateTimes to exclude seconds/fractional-seconds
    • Support Arrays of FunctionBlocks that use an FB_init inline
    • Allow "Stray" semicolons that would otherwise have no effect
    • Allow Namespaced (dotted) access to structures in declarations when setting a default.
    • Separate Global Variable Attributes to allow inclusion of "INTERNAL"
    • Fix function call handling of empty arguments
  • Refactor/enhancement: better CLI handling of non-TwinCAT files by @klauer in #37
  • Bugfix: small regression after IndirectionType adjustments of #33 by @klauer in #38
  • Maintenance: test coverage and dropping support for lark < 1.0 by @klauer in #39
  • CI: code coverage via pytest-cov and codecov by @klauer in #40
  • Maintenance/tests: Move existing example to test suite + remove invalid one by @klauer in #41
  • Bugfix: miscellaneous transformer fixes to get JSON serialization working by @klauer in #42
  • Test suite: fix source file naming in test suite by @klauer in #45

Full Changelog: v0.4.0...v0.5.0

v0.4.0

06 May 22:33
a66637a
Compare
Choose a tag to compare

What's Changed

Grammar enhancements

Development updates

Continuous integration additions:

New Contributors

Thanks for the excellent feedback, contributions and help, @engineerjoe440!

Full Changelog: v0.3.0...v0.4.0

v0.3.0

26 Feb 00:43
a4f241a
Compare
Choose a tag to compare

Changes / fixes / etc

A big release with an overhaul of most aspects of blark.

  • Add round-trippable Python dataclasses for structured text grammar
    • Source code -> dataclasses you can interact with -> source code
    • Comments and pragmas can be retained
    • Formatting is not retained (blark has an abstract - not full - syntax tree)
  • Added start of sphinx domain for code documentation generation
  • Added UNION, PROPERTY support and many other grammar fixes
  • Nested comments are handled fully
  • Added dependency store
    • Parse project + all dependencies that have source code available
    • Using the summary classes, relatively easily poke around with source code objects
  • Removed unused dataclasses + grammar rules
    • Closes #18
    • Up for discussion if I'm missing something
    • Task config, instruction lists, SFC networks, ...
  • Grammar fixes
    • Functions can return indirect types
    • Added variable attribute flags to blocks where accepted, according to infosys docs
  • Improved code summary utilities
    • Easier to use to find declarations and such
    • Add ProgramSummary, GlobalVariableSummary
    • Base type EXTENDS declarations are wrapped into the derived type
  • Added program and global variables to documentation generation (sphinx domain)
  • Added apischema-based serialization in the test suite
    • This helped improve the type annotations in places as round-tripping validation was failing
    • However, Python 3.9+ with apischema 0.17.5 (did not test other versions) is hitting an infinite loop when attempting to serialize most of the data structures. Serialization testing for those Python versions is disabled for now until I get a chance to dig in / report the issue if it's not on my end
    • Python 3.7 and Python 3.8 are testing serialization with the transformed dataclasses just fine though

PRs

  • REF/ENH: round-trippable Python dataclasses for structured text grammar by @klauer in #9
  • ENH: initial attempts at code summary layer, sphinx domain by @klauer in #12
  • ENH: dependencies, first pass at serialization, and more by @klauer in #19

Full Changelog: v0.1.7...v0.3.0

v0.1.7: Merge pull request #8 from klauer/fix_struct_extends

20 Aug 22:05
a4da063
Compare
Choose a tag to compare

v0.1.5: Merge pull request #6 from klauer/mnt_clean

11 Aug 18:51
a79fe68
Compare
Choose a tag to compare
  • Grammar clean-up
  • Enum fixes
  • Removal of original IEC grammar; so we're lark-only from here on out
  • Addition of pre-commit, versioneer, etc.