Exemple #1
0
    def __parse_literal(self, start_point_loc):
        '''
        Private function to parse a single LITERAL expression. The _file
        variable should be in a state starting with (without quotes):
        '<val>)'
        That is, the '(lit ' section has alread been read.

        Returns an instance of Literal()
        '''

        lit_val = self.__parse_word()
        loc = start_point_loc.span(self.__get_point_loc())

        # Convert the value to the correct type.
        lit_type = Type.get_type_from_string_val(loc, lit_val)
        lit_val = Type.convert_type(loc, lit_type, lit_val)

        return Literal(loc, lit_type, lit_val)