25using namespace tao::pegtl;
50template <
typename... EXCLUSION_RULES>
56template <
typename... EXCLUSION_RULES>
57struct STRING_EXCLUDING : plus<STR_SEGMENT_EXCLUDING<EXCLUSION_RULES...>, opt<LINE_CONTINUATION>> {};
63template <
char... CHAR_TO_FIND>
64struct spaced_ch : seq<star<WHITESPACE>, one<CHAR_TO_FIND...>>{};
69struct QUOTED_STRING : seq<one<'"'>, STRING_EXCLUDING<one<'"'>>, one<'"'>> {};
86 STRING_EXCLUDING<one<')'>>
101 STRING_EXCLUDING<seq<one<')'>, eolf>>
120 TAO_PEGTL_ISTRING( "FORMAT" ),
122 CURRENT_FORMAT_NUMBER,
144 HIERARCHY_CURRENT_NODE,
145 plus<WHITESPACE_OR_CONTINUATION>,
146 opt<HIERARCHY_PARENT_NODE>,
147 star<WHITESPACE_OR_CONTINUATION>,
149 star<WHITESPACE_OR_CONTINUATION>,
150 star<HIERARCHY_PART_NAME, star<WHITESPACE_OR_CONTINUATION>>,
182 opt<seq<spaced_ch<':'>, PART_VERSION>>,
183 opt<seq<spaced_ch<';'>, PART_DESCRIPTION>>,
218 TAO_PEGTL_ISTRING( "*VALUE"),
234 plus<WHITESPACE_OR_CONTINUATION>,
245 TAO_PEGTL_ISTRING( "*PNM"),
253struct PINLABEL : sor<QUOTED_STRING, STRING_EXCLUDING<WHITESPACE>> {};
257 plus<WHITESPACE_OR_CONTINUATION>,
268 TAO_PEGTL_ISTRING( "*PLB"),
269 plus<PINLABEL_ENTRY>,
280 plus<WHITESPACE_OR_CONTINUATION>,
282 plus<one<'='>, star<WHITESPACE_OR_CONTINUATION>, EQUIVALENT_PIN>
290 TAO_PEGTL_ISTRING( "*EQU"),
291 EQUIVALENT_PINS_GROUP,
292 star<one<','>, EQUIVALENT_PINS_GROUP>,
305 TAO_PEGTL_ISTRING( "*SYM"),
307 opt<SYM_ELEMENT_NAME>,
319 plus<WHITESPACE_OR_CONTINUATION>,
330 TAO_PEGTL_ISTRING( "*INT"),
341 TAO_PEGTL_ISTRING( "*EXT"),
355 plus<INTERNAL_SWAP_GATE>
367 plus<EXTERNAL_SWAP_GATE>
379 TAO_PEGTL_ISTRING( "*DFN"),
391 TAO_PEGTL_ISTRING( "*NGS"),
401 TAO_PEGTL_ISTRING( "*NPV"),
412 TAO_PEGTL_ISTRING( "*STM"),
425 TAO_PEGTL_ISTRING( "*MXP"),
439 TAO_PEGTL_ISTRING( "*SPI"),
441 opt<SPICE_PART_NAME>,
456 TAO_PEGTL_ISTRING( "*PAC"),
458 opt<ACCEPTANCE_PART_NAME>,
475 USER_PART_ATTRIBUTE_NAME,
477 USER_PART_ATTRIBUTE_VALUE,
490template<
char START_TOKEN>
519struct SCH_NAME : sor<QUOTED_STRING, STRING_EXCLUDING<spaced_ch<'('>>> {};
535 opt< one<'!'>, PIN_TYPE>,
536 opt< one<':'>, PIN_LOADING>
540struct PIN_LIST : plus<PIN_ENTRY, star<WHITESPACE>, opt<LINE_CONTINUATION>> {};
583 star<HIDDEN_PIN_ENTRY>
595 star<star<EMPTY_LINE>, HIERARCHY_NODE_ENTRY>,
605 opt<TAO_PEGTL_ISTRING( ".END"), opt<eol>>,
619struct VALID_HEADER : sor<FORMAT, seq< rep_max<5,EMPTY_LINE>, PART_HEADER>>{};
Empty line with whitespaces.
Grammar for CADSTAR Parts Library file format (*.lib)
Any text in the format can span multiple lines using '&'.
String inside quotation marks.
String inside single quotation marks.
String with optional line continuation and exclusion rules.
String inside brackets with preceding spaces, ending with EOL or EOF.
String inside brackets with preceding spaces.
String segment( no line continuation ), with exclusion rules.
Needed, because PEGTL "space" includes newline characters.
Control character with or without preceding whitespace.