예제 #1
0
void set_with_selector__formatSource(caValue* source, Term* term)
{
    Term* selector = term->input(1);
    if (selector->function != FUNCS.selector) {
        format_term_source_default_formatting(source, term);
        return;
    }

    // Don't call format_name_binding here

    format_source_for_input(source, term, 0, "", "");

    selector_format_source(source, selector);

    append_phrase(source, term->stringProp("syntax:preEqualsSpace",""), term, tok_Whitespace);

    if (term->hasProperty("syntax:rebindOperator")) {
        append_phrase(source, term->stringProp("syntax:rebindOperator",""), term, tok_Equals);
        append_phrase(source, term->stringProp("syntax:postEqualsSpace",""), term, tok_Whitespace);
        format_source_for_input(source, term->input(2), 1, "", "");
    } else {
        append_phrase(source, "=", term, tok_Equals);
        append_phrase(source, term->stringProp("syntax:postEqualsSpace",""), term, tok_Whitespace);
        format_source_for_input(source, term, 2, "", "");
    }
}
예제 #2
0
파일: kernel.cpp 프로젝트: whunmr/circa
void section_block_formatSource(caValue* source, Term* term)
{
    format_name_binding(source, term);
    append_phrase(source, "section", term, sym_None);
    append_phrase(source, " ", term, sym_Whitespace);
    format_block_source(source, nested_contents(term), term);
}
예제 #3
0
파일: namespace.cpp 프로젝트: arn-e/circa
 void format_source(caValue* source, Term* term)
 {
     append_phrase(source, "namespace ", term, sym_Keyword);
     append_phrase(source, term->name, term, sym_TermName);
     format_block_source(source, nested_contents(term), term);
     append_phrase(source, term->stringProp("syntax:preEndWs", ""),
             term, tok_Whitespace);
 }
예제 #4
0
파일: for.cpp 프로젝트: levelplane/circa
 void format_heading(StyledSource* source, Term* term)
 {
     format_name_binding(source, term);
     append_phrase(source, "for ", term, phrase_type::KEYWORD);
     append_phrase(source, for_loop_get_iterator_name(term),
             term, phrase_type::UNDEFINED);
     append_phrase(source, " in ", term, phrase_type::KEYWORD);
     format_source_for_input(source, term, 0);
 }
예제 #5
0
 void formatSource(caValue* source, Term* term)
 {
     if (term->boolProp("syntax:brackets", false)) {
         format_name_binding(source, term);
         format_source_for_input(source, term, 0);
         append_phrase(source, "[", term, tok_LBracket);
         format_source_for_input(source, term, 1);
         append_phrase(source, "]", term, tok_LBracket);
     } else {
         format_term_source_default_formatting(source, term);
     }
 }
예제 #6
0
파일: switch.cpp 프로젝트: mokerjoke/circa
 void switch_formatSource(caValue* source, Term* term)
 {
     format_name_binding(source, term);
     append_phrase(source, "switch ", term, name_Keyword);
     format_source_for_input(source, term, 0);
     format_branch_source(source, nested_contents(term), term);
 }
예제 #7
0
파일: for.cpp 프로젝트: levelplane/circa
 void formatSource(StyledSource* source, Term* term)
 {
     format_heading(source, term);
     format_branch_source(source, nested_contents(term), term);
     append_phrase(source, term->stringPropOptional("syntax:whitespaceBeforeEnd", ""),
         term, TK_WHITESPACE);
 }
예제 #8
0
파일: string_type.cpp 프로젝트: arn-e/circa
void string_format_source(caValue* source, Term* term)
{
    if (term->hasProperty("syntax:originalString")) {
        append_phrase(source, term->stringProp("syntax:originalString", ""),
                term, tok_String);
        return;
    }

    std::string quoteType = term->stringProp("syntax:quoteType", "'");
    std::string result;
    if (quoteType == "<")
        result = "<<<" + as_string(term_value(term)) + ">>>";
    else
        result = quoteType + as_cstring(term_value(term)) + quoteType;

    append_phrase(source, result, term, tok_String);
}
예제 #9
0
void selector_format_source(caValue* source, Term* term)
{
    // Append subscripts for each selector element
    for (int i=0; i < term->numInputs(); i++) {
        Term* input = term->input(i);

        if (is_value(input) && is_string(term_value(input))) {
            append_phrase(source, ".", input, tok_Dot);
            append_phrase(source, as_string(term_value(input)),
                    input, tok_Identifier);

        } else {
            append_phrase(source, "[", term, tok_LBracket);
            format_source_for_input(source, term, i, "", "");
            append_phrase(source, "]", term, tok_LBracket);
        }
    }
}
예제 #10
0
    void format_source(caValue* source, Term* term)
    {
        std::stringstream strm;
        if (term->stringProp("syntax:integerFormat", "dec") == "hex")
            strm << "0x" << std::hex;

        strm << as_int(term_value(term));
        append_phrase(source, strm.str(), term, tok_Integer);
    }
예제 #11
0
파일: if_block.cpp 프로젝트: arn-e/circa
    void formatSource(caValue* source, Term* term)
    {
        format_name_binding(source, term);

        Block* contents = nested_contents(term);

        int index = 0;
        while (contents->get(index)->function == FUNCS.input)
            index++;

        bool firstCase = true;

        for (; index < contents->length(); index++) {
            Term* caseTerm = contents->get(index);

            if (caseTerm->function != FUNCS.case_func)
                break;

            if (is_hidden(caseTerm))
                continue;

            append_phrase(source,
                    caseTerm->stringProp("syntax:preWhitespace", ""),
                    caseTerm, tok_Whitespace);

            if (firstCase) {
                append_phrase(source, "if ", caseTerm, sym_Keyword);
                format_source_for_input(source, caseTerm, 0);
                firstCase = false;
            } else if (caseTerm->input(0) != NULL) {
                append_phrase(source, "elif ", caseTerm, sym_Keyword);
                format_source_for_input(source, caseTerm, 0);
            }
            else
                append_phrase(source, "else", caseTerm, sym_None);

            // whitespace following the if/elif/else
            append_phrase(source,
                    caseTerm->stringProp("syntax:lineEnding", ""),
                    caseTerm, tok_Whitespace);

            format_block_source(source, nested_contents(caseTerm), caseTerm);
        }
    }
예제 #12
0
파일: switch.cpp 프로젝트: mokerjoke/circa
 void case_formatSource(caValue* source, Term* term)
 {
     append_phrase(source, "case ", term, name_Keyword);
     format_source_for_input(source, term, 0);
     format_branch_source(source, nested_contents(term), term);
 }
예제 #13
0
파일: null.cpp 프로젝트: mokerjoke/circa
 void formatSource(caValue* source, Term* term)
 {
     append_phrase(source, "null", term, tok_Null);
 }
예제 #14
0
파일: for.cpp 프로젝트: levelplane/circa
 void discard_formatSource(StyledSource* source, Term* term)
 {
     append_phrase(source, "discard", term, phrase_type::KEYWORD);
 }
예제 #15
0
파일: for.cpp 프로젝트: levelplane/circa
 void continue_formatSource(StyledSource* source, Term* term)
 {
     append_phrase(source, "continue", term, phrase_type::KEYWORD);
 }
예제 #16
0
void formatSource(caValue* source, Term* term)
{
    append_phrase(source, term->stringProp("originalText",""), term, name_None);
}
예제 #17
0
파일: bool.cpp 프로젝트: RickMoynihan/circa
 void format_source(caValue* source, Term* term)
 {
     append_phrase(source, bool_t::to_string(term_value(term)), term, tok_Bool);
 }
예제 #18
0
파일: symbols.cpp 프로젝트: arn-e/circa
static void format_source(caValue* source, Term* term)
{
    std::string s = symbol_to_string(term_value(term));
    append_phrase(source, s.c_str(), term, tok_ColonString);
}
예제 #19
0
 void formatSource(caValue* source, Term* term)
 {
     append_phrase(source, term->name, term, sym_UnknownIdentifier);
 }
예제 #20
0
 void format_source(caValue* source, Term* term)
 {
     append_phrase(source, color_t::to_string(term), term, tok_Color);
 }
예제 #21
0
파일: neg.cpp 프로젝트: levelplane/circa
 void formatSource(StyledSource* source, Term* term)
 {
     append_phrase(source, "-", term, phrase_type::INFIX_OPERATOR);
     format_source_for_input(source, term, 0);
 }
예제 #22
0
파일: for.cpp 프로젝트: levelplane/circa
 void break_formatSource(StyledSource* source, Term* term)
 {
     append_phrase(source, "break", term, phrase_type::KEYWORD);
 }