Пример #1
0
// Purpose:
//
//*****************************************************************************


// ListOfKeywords_Inc.cpp
//
// This file gets included as pure CPP as part of the parser definition,
// otherwise the parser would become way too large to keep it understandable
// and AFAIK we can't distribute it over multiple modules.
//
// We also add "invalid_symbol" everywhere to detect invalid characters
// not only in symbols but also where keywords are expected.

// Options
keyword_on = str_p("on") | "On" | "ON" | invalid_symbol;
keyword_off = str_p("off") | "Off" | "OFF" | invalid_symbol;

// Beginning of custom code
keyword_custom = str_p("custom") | "Custom" | "CUSTOM" | invalid_symbol;

// List extension (not standard PPL)
keyword_lists = str_p("lists") | "Lists" | "LISTS" | invalid_symbol;
keyword_list = str_p("list") | "List" | "LIST" | invalid_symbol;
keyword_new = str_p("new") | "New" | "NEW" | invalid_symbol;

// Symbol extension (not standard PPL)
keyword_symbols = str_p("symbols") | "Symbols" | "SYMBOLS" | invalid_symbol;
keyword_symbol = str_p("symbol") | "Symbol" | "SYMBOL" | invalid_symbol;
keyword_end = str_p("end") | "End" | "END" | invalid_symbol;
Пример #2
0
                (*(anychar_p - (chset_t('<') | '&' | '"')))[&XMLDoc::AddAttribute]
                | *(Reference)
               )
            >> '"'
        |   '\''
            >> (
                (*(anychar_p - (chset_t('<') | '&' | '\'')))[&XMLDoc::AddAttribute]
                | *(Reference)
               )
            >> '\''
        ;

    chset_t CharDataChar(anychar_p - (chset_t('<') | chset_t('&')));

    CharData =
        (*(CharDataChar - str_p("]]>")))[&XMLDoc::AppendToText]
        ;

    Comment1 =
        *(
          (Char - ch_p('-'))
          | (ch_p('-') >> (Char - ch_p('-')))
          )
        ;

    Comment =
        str_p("<!--") >> Comment1 >> str_p("-->")
        ;

    CDSect =
        str_p("<![CDATA[") >> CData >> str_p("]]>")