Changeset 171

Show
Ignore:
Timestamp:
04/04/08 06:57:19 (9 months ago)
Author:
tal
Message:
Added a few things not yet supported by the parser.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/feaTools/trunk/Lib/feaTools/writers/fdkSyntaxWriter.py

    r111 r171  
    6666        return lookup 
    6767 
     68    def lookupReference(self, name): 
     69        t = "lookup %s;" % name 
     70        self._instructions.append(t) 
     71 
    6872    def classDefinition(self, name, contents): 
    6973        t = "%s = [%s];" % (name, self._list2String(contents)) 
     
    9498        self._instructions.append(t) 
    9599 
    96     def gsubType6(self, precedingContext, target, trailingContext, replacement): 
     100    def gsubType6(self, precedingContext, target, trailingContext, replacement, ignore=False): 
    97101        if isinstance(precedingContext, list): 
    98102            precedingContext = self._list2String(precedingContext) 
    99103        if isinstance(target, list): 
    100             target = [i + "'" for i in target] 
    101104            target = self._list2String(target) 
     105        target += "'" 
    102106        if isinstance(trailingContext, list): 
    103107            trailingContext = self._list2String(trailingContext) 
    104108        if isinstance(replacement, list): 
    105109            replacement = self._list2String(replacement) 
    106         if precedingContext and trailingContext: 
    107             t = "sub %s %s %s by %s;" % (precedingContext, target, trailingContext, replacement) 
    108         elif precedingContext: 
    109             t = "sub %s %s by %s;" % (precedingContext, target, replacement) 
    110         elif trailingContext: 
    111             t = "sub %s %s by %s;" % (target, trailingContext, replacement) 
     110        if ignore: 
     111            if precedingContext and trailingContext: 
     112                t = "ignore sub %s %s %s;" % (precedingContext, target, trailingContext) 
     113            elif precedingContext: 
     114                t = "ignore sub %s %s;" % (precedingContext, target) 
     115            elif trailingContext: 
     116                t = "ignore sub %s %s;" % (target, trailingContext) 
     117            else: 
     118                t = "ignore sub %s;" % target 
    112119        else: 
    113             t = "sub %s by %s;" % (target, replacement) 
     120            if precedingContext and trailingContext: 
     121                t = "sub %s %s %s by %s;" % (precedingContext, target, trailingContext, replacement) 
     122            elif precedingContext: 
     123                t = "sub %s %s by %s;" % (precedingContext, target, replacement) 
     124            elif trailingContext: 
     125                t = "sub %s %s by %s;" % (target, trailingContext, replacement) 
     126            else: 
     127                t = "sub %s by %s;" % (target, replacement) 
    114128        self._instructions.append(t) 
    115129 
     
    134148 
    135149    def languageSystem(self, languageTag, scriptTag): 
    136         t = "languagesystem %s %s;" % (languageTag, scriptTag) 
     150        t = "languagesystem %s %s;" % (scriptTag, languageTag) 
    137151        self._instructions.append(t) 
    138152 
     
    151165        t = "include(%s)" % path 
    152166        self._instructions.append(t) 
     167 
     168    def subtableBreak(self): 
     169        t = "subtable;" 
     170        self._instructions.append(t) 
     171