# Path: godot/parsing_util.py
# class ToBoolean(TokenConverter):
# class ToInteger(TokenConverter):
# class ToFloat(TokenConverter):
# class ToTuple(TokenConverter):
# class ToList(TokenConverter):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
# def make_unique_name(base, existing=[], format="%s_%s"):
# def nsplit(seq, n=2):
# def windows(iterable, length=2, overlap=0, padding=True):
# 
# Path: godot/component/api.py



from enthought.enable.api import Component
from pyparsing import __version__ as pyparsing_version
from colorsys import hsv_to_rgb
from pyparsing import \
    Literal, CaselessLiteral, Word, Upcase, OneOrMore, ZeroOrMore, Forward, \
    NotAny, delimitedList, oneOf, Group, Optional, Combine, alphas, nums, \
    restOfLine, cppStyleComment, nums, alphanums, printables, empty, \
    quotedString, CharsNotIn, _noncomma, Suppress, nestedExpr, Suppress, Or
from godot.parsing_util import \
    real, integer, minus, quote, equals, colour, nsplit, ToInteger
from godot.component.api import \
    Pen, Ellipse, Polygon, Polyline, BSpline, Text

    def proc_fill_color(self, tokens):
        """ Sets the pen fill color. """

        self.pen.fill_color = self._proc_color(tokens)
        return []


    def proc_stroke_color(self, tokens):
        """ Sets the pen stroke color. """

        self.pen.color = self._proc_color(tokens)
        return []


    def _proc_color(self, tokens):
        """ The color traits of a Pen instance must be a string of the form
        (r,g,b) or (r,g,b,a) where r, g, b, and a are integers from 0 to 255,
        a wx.Colour instance, an integer which in hex is of the form 0xRRGGBB,
        where RR is red, GG is green, and BB is blue or a valid color name. """

        keys = tokens.keys()
        if "red" in keys: # RGB(A)
            rr, gg, bb = tokens["red"], tokens["green"], tokens["blue"]
            hex2int = lambda h: int(h, 16)
            if "alpha" in keys:
                a = tokens["alpha"]
                c = str((hex2int(rr), hex2int(gg), hex2int(bb), hex2int(a)))
            else:
                c = str((hex2int(rr), hex2int(gg), hex2int(bb)))

# Path: godot/parsing_util.py
# class ToBoolean(TokenConverter):
# class ToInteger(TokenConverter):
# class ToFloat(TokenConverter):
# class ToTuple(TokenConverter):
# class ToList(TokenConverter):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
#     def postParse(self, instring, loc, tokenlist):
# def make_unique_name(base, existing=[], format="%s_%s"):
# def nsplit(seq, n=2):
# def windows(iterable, length=2, overlap=0, padding=True):
# 
# Path: godot/component/api.py



# Path: godot/xdot_parser.py
from enthought.enable.api import Component
from pyparsing import __version__ as pyparsing_version
from colorsys import hsv_to_rgb
from pyparsing import \
    Literal, CaselessLiteral, Word, Upcase, OneOrMore, ZeroOrMore, Forward, \
    NotAny, delimitedList, oneOf, Group, Optional, Combine, alphas, nums, \
    restOfLine, cppStyleComment, nums, alphanums, printables, empty, \
    quotedString, CharsNotIn, _noncomma, Suppress, nestedExpr, Suppress, Or
from godot.parsing_util import \
    real, integer, minus, quote, equals, colour, nsplit, ToInteger
from godot.component.api import \
    Pen, Ellipse, Polygon, Polyline, BSpline, Text


    def proc_fill_color(self, tokens):
        """ Sets the pen fill color. """

        self.pen.fill_color = self._proc_color(tokens)
        return []


    def proc_stroke_color(self, tokens):
        """ Sets the pen stroke color. """

        self.pen.color = self._proc_color(tokens)
        return []


    def _proc_color(self, tokens):
        """ The color traits of a Pen instance must be a string of the form
        (r,g,b) or (r,g,b,a) where r, g, b, and a are integers from 0 to 255,
        a wx.Colour instance, an integer which in hex is of the form 0xRRGGBB,
        where RR is red, GG is green, and BB is blue or a valid color name. """

        keys = tokens.keys()
        if "red" in keys: # RGB(A)
            rr, gg, bb = tokens["red"], tokens["green"], tokens["blue"]
            hex2int = lambda h: int(h, 16)
            if "alpha" in keys:
                a = tokens["alpha"]
                c = str((hex2int(rr), hex2int(gg), hex2int(bb), hex2int(a)))
            else:
                c = str((hex2int(rr), hex2int(gg), hex2int(bb)))

        elif "hue" in keys: # HSV