38 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Khaled Hosny
80dac9c0f4 [voltLib] Accept False for LookupDefinition.reversal 2020-06-08 02:52:58 +02:00
Khaled Hosny
a1df9175ee [voltLib] Support writing back ast as VOLT data
Adds __str__() method to ast classes that writes back VOLT data. Tries
to replicate VOLT syntax idiosyncrasies as much as possible for better
round-trip conversion.
2020-06-04 14:08:20 +02:00
Khaled Hosny
18886da333 [voltLib] Use NamedTuple for pos
Using a plain tuple here is ugly, it should have been another ast class,
using NamedTuple to not break backward compatibility. Needed for next
commit.
2020-06-04 14:08:20 +02:00
Khaled Hosny
5cc5d80871 [voltLib] Deduplicate some ast code
In preparation for next commits. Also remove unused classes.
2020-06-04 14:08:12 +02:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Khaled Hosny
cedf79b505 [voltLib] Return a tuple from parse_coverage_()
This is a followup to commit 94633e9f46975c356ec3a2d21ed30768c2fa0cd5,
where I mistakenly made it return an Enum but parse_coverage_() it not
used only for ENUMs and in many (most?) places returning an Enum is
wrong as you have a list of separate items that has to rmain separate.
2019-02-02 01:13:14 +02:00
Khaled Hosny
b6ec12bad0 [voltLib] Distinguish different PROCESS_MARKS
PROCESS_MARKS followed by a group name is used for markAttachmentType
lookup flag, while followed by MARK_GLYPH_SET is used for
useMarkFilteringSet. The code parsed both correctly but did not
distinguish between the two in the generated AST as it should since they
compile to different lookup flags.
2019-01-23 10:18:44 +02:00
Khaled Hosny
4236772ec1 [voltLib] glyphSet() should return tuple
We need to maintain the glyph order and keep any duplicates.
2019-01-22 09:42:22 +02:00
Khaled Hosny
94633e9f46 [voltLib] Fix parsing glyph groups
* Fix ast.GroupDefinition.glyphSet() by using ast.GlyphName,
  ast.GroupName and ast.Range in Parser.parse_coverage_(), and making it return
  ast.Enum.

* Add ast.Enum.__len_() to fix the calculation of max_src and max_dest
  in Parser.parse_substitution_(). I’m not sure I understand the logic
  of this many to many check, will double check later.

* Update the test suite to reflect this. Had to add ast.Enum.__eq__() to
  make it less painful, and __hash__() as otherwise ast.Enum wouldn’t be
  used as a key in dicts (not sure this is a goo idea either, will
  double check later).
2019-01-22 09:42:22 +02:00
Cosimo Lupo
1fb1529a18
[voltLib.ast] same as feaLib, location=None by default 2018-02-27 19:00:08 +00:00
moyogo
67c08a1f63 [voltLib] ast: don’t use feaLib.ast 2016-09-15 06:58:17 +01:00
moyogo
31a1aa8c7a [voltLib] use tuple for coverage and in mapping 2016-09-14 17:25:26 +01:00
moyogo
7541fc7b1a [voltLib] raise on cyclic groups 2016-09-14 17:25:26 +01:00
moyogo
b758c2b584 [voltLib] reuse GlyphDefinition.glyphs_ if present 2016-09-14 17:25:25 +01:00
moyogo
bc63725beb [voltLib] Add GlyphName, Enum, GroupName, Range to ast. Add resolve_group and glyph_range to Parser 2016-09-14 17:25:25 +01:00
moyogo
e729fd9b54 [voltLib] parse ReverseChainingSingle substitution 2016-09-14 17:25:25 +01:00
moyogo
e93f7384a5 [voltLib] parse substitution as single, multiple or ligature sub 2016-09-14 17:25:25 +01:00
moyogo
80a4cc6d72 [voltLib] change how adjust_single is parsed 2016-09-14 17:25:24 +01:00
moyogo
eb3a2cccd9 [voltLib] parse process_base and process_marks differently for LookupDefinition 2016-09-14 17:25:24 +01:00
moyogo
6caba42cc2 [voltLib] 'adjust_pair' instead of just 'adjust' 2016-09-14 17:25:24 +01:00
moyogo
b70ef7accd [voltLib] parse REVERSAL for reverse chaining context singl substitution 2016-09-14 17:25:23 +01:00
moyogo
7a64ce083b [voltLib] add LookupBlock 2016-09-14 17:25:23 +01:00
moyogo
90ead4420c [voltLib] add PositionAttachCursiveDefinition and PositionAdjustSingleDefinition 2016-09-14 17:25:20 +01:00
moyogo
aa723adfcd [voltLib] formatting ast.py 2016-09-14 17:21:41 +01:00
moyogo
ed598b3cf6 [voltLib] Add process_marks to LookupDefinition 2016-09-14 17:21:41 +01:00
moyogo
ed34ef3eca [voltLib] Add settings (ppem, compiler flags, cmap format) 2016-09-14 17:21:41 +01:00
moyogo
6fab2a4f7b [voltLib] Modify PositionAttachDefinition and parse_position to handle multiple TO coverages 2016-09-14 17:21:41 +01:00
moyogo
923fd2cb4d [voltLib] Add adjust pair positioning 2016-09-14 17:21:41 +01:00
moyogo
aaad2be5a5 [voltLib] Add anchor, pos, and attach 2016-09-14 17:21:41 +01:00
moyogo
ffa929b404 [voltLib] Context can take multiple except/in_context, multiple left or right contexts 2016-09-14 17:21:41 +01:00
moyogo
5571f2c12a [voltLib] Add def lookup, simple substitution 2016-09-14 17:21:41 +01:00
moyogo
c26e3228ce [voltLib] Add coverage, change group and enum 2016-09-14 17:21:41 +01:00
moyogo
32f8c9c1e7 [voltLib] Add feature definition 2016-09-14 17:21:41 +01:00
moyogo
888c862433 [voltLib] Add script and langsys 2016-09-14 17:21:41 +01:00
moyogo
1c4de40936 [voltLib] expand enum when creating GroupDefinition 2016-09-14 17:21:41 +01:00
moyogo
2ad6c3df12 [voltLib] Add SymbolTable 2016-09-14 17:21:41 +01:00
moyogo
34e7a8d904 [voltLib] Add ast.GlyphDefinition 2016-09-14 17:21:41 +01:00