예제 #1
0
def _type_definitions():
    token_descr = token_db.token_type_definition
    if Setup.computed_gotos_f: type_goto_label  = "void*"
    else:                      type_goto_label  = "int32_t"

    type_def_list = [
        ("lexatom_t",         Setup.lexatom.type),
        ("token_id_t",        token_descr.token_id_type),
        ("token_line_n_t",    token_descr.line_number_type.get_pure_text()),
        ("token_column_n_t",  token_descr.column_number_type.get_pure_text()),
        ("acceptance_id_t",   "int"),
        ("indentation_t",     "int"),
        ("stream_position_t", "intmax_t"),
        ("goto_label_t",      type_goto_label)
    ]

    excluded = ""
    if not blackboard.required_support_indentation_count():
        excluded = "indentation_t"

    def_str = "\n".join(Lng.QUEX_TYPE_DEF(original, customized_name) 
                        for customized_name, original in type_def_list 
                        if customized_name != excluded) \
              + "\n"

    return Lng.FRAME_IN_NAMESPACE_MAIN(def_str)
예제 #2
0
파일: core.py 프로젝트: smmckay/quex3
def _analyzer_functions_get(ModeDB):
    mode_name_list = ModeDB.keys()  

    code = flatten_list_of_lists( 
        engine_generator.do_with_counter(mode, mode_name_list) for mode in ModeDB.itervalues() 
    )

    code.append(
        engine_generator.comment_match_behavior(ModeDB.itervalues())
    )

    # generate frame for analyser code
    return Lng.FRAME_IN_NAMESPACE_MAIN("".join(code))
예제 #3
0
def do(ModeDb):
    LexerClassName = Setup.analyzer_class_name
    DerivedClassName = Setup.analyzer_derived_class_name

    mode_setup_txt = __setup(ModeDb)

    # -- mode class member function definitions (on_entry, on_exit, has_base, ...)
    mode_class_member_functions_txt = write_member_functions(ModeDb.values())

    txt = Lng.FRAME_IN_NAMESPACE_MAIN("".join([
        mode_setup_txt,
        mode_class_member_functions_txt,
    ]))

    return blue_print(txt,
                      [["$$LEXER_CLASS_NAME$$", LexerClassName],
                       ["$$LEXER_DERIVED_CLASS_NAME$$", DerivedClassName]])