-
Notifications
You must be signed in to change notification settings - Fork 867
odb: Use snake_case for LEF58 cut rules parser variables (#2275) #9722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b194f05
db9e60c
97b88a4
195f005
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -328,7 +328,7 @@ bool parse( | |||||||||||||
| odb::lefinReader* lefinReader, | ||||||||||||||
| std::vector<std::pair<odb::dbObject*, std::string>>& incomplete_props) | ||||||||||||||
| { | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> LAYER_CUTCLASS | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> layer_cut_class_rule | ||||||||||||||
| = (lit("CUTCLASS") | ||||||||||||||
| >> _string[boost::bind(&setCutClass, _1, parser, layer)] >> -( | ||||||||||||||
| lit("SHORTEDGEONLY")[boost::bind( | ||||||||||||||
|
|
@@ -376,7 +376,7 @@ bool parse( | |||||||||||||
| parser, | ||||||||||||||
| &odb::dbTechLayerCutSpacingRule::setWrongDirection, | ||||||||||||||
| true)])); | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> LAYER | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> layer_rule | ||||||||||||||
| = (lit("LAYER") >> _string[boost::bind( | ||||||||||||||
| &addLayerSubRule, _1, parser, layer, boost::ref(incomplete_props))] | ||||||||||||||
| >> -( | ||||||||||||||
|
|
@@ -386,9 +386,9 @@ bool parse( | |||||||||||||
| true)] | ||||||||||||||
| | lit("ORTHOGONALSPACING") >> double_[boost::bind( | ||||||||||||||
| &setOrthogonalSpacing, _1, parser, lefinReader)] | ||||||||||||||
| | LAYER_CUTCLASS)); | ||||||||||||||
| | layer_cut_class_rule)); | ||||||||||||||
|
|
||||||||||||||
| qi::rule<std::string::const_iterator, space_type> ADJACENTCUTS | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> adjacent_cuts_rule | ||||||||||||||
| = (lit("ADJACENTCUTS") >> (string("1") | string("2") | string("3")) | ||||||||||||||
| >> -(lit("EXACTALIGNED") >> int_) | ||||||||||||||
| >> -(lit("TWOCUTS") >> int_ >> -lit("SAMECUT")[boost::bind( | ||||||||||||||
|
|
@@ -406,12 +406,13 @@ bool parse( | |||||||||||||
| >> -string("SAMEMASK"))[boost::bind( | ||||||||||||||
| &addAdjacentCutsSubRule, _1, parser, layer, lefinReader)]; | ||||||||||||||
|
|
||||||||||||||
| qi::rule<std::string::const_iterator, space_type> PARALLELOVERLAP | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> parallel_overlap_rule | ||||||||||||||
| = (lit("PARALLELOVERLAP") | ||||||||||||||
| >> -(string("EXCEPTSAMENET") | string("EXCEPTSAMEMETAL") | ||||||||||||||
| | string("EXCEPTSAMEVIA") | string("EXCEPTSAMEMETALOVERLAP"))) | ||||||||||||||
| [boost::bind(&addParallelOverlapSubRule, _1, parser)]; | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> PARALLELWITHIN_CUTCLASS | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> | ||||||||||||||
| parallel_within_cut_class_rule | ||||||||||||||
| = (lit("CUTCLASS") | ||||||||||||||
|
Comment on lines
+414
to
416
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting is unconventional. A more standard way to break long declaration lines is to place the
Suggested change
|
||||||||||||||
| >> _string[boost::bind(&setCutClass, _1, parser, layer)] | ||||||||||||||
| >> -(lit("LONGEDGEONLY")[boost::bind( | ||||||||||||||
|
|
@@ -424,23 +425,23 @@ bool parse( | |||||||||||||
| >> double_ >> lit("WITHIN") >> double_)[boost::bind( | ||||||||||||||
| &setParWithinEnclosure, _1, parser, lefinReader)])); | ||||||||||||||
|
|
||||||||||||||
| qi::rule<std::string::const_iterator, space_type> PARALLELWITHIN | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> parallel_within_rule | ||||||||||||||
| = ((lit("PARALLELWITHIN") >> double_ | ||||||||||||||
| >> -string("EXCEPTSAMENET"))[boost::bind( | ||||||||||||||
| &addParallelWithinSubRule, _1, parser, lefinReader)] | ||||||||||||||
| >> -PARALLELWITHIN_CUTCLASS); | ||||||||||||||
| >> -parallel_within_cut_class_rule); | ||||||||||||||
|
|
||||||||||||||
| qi::rule<std::string::const_iterator, space_type> SAMEMETALSHAREDEDGE | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> same_metal_shared_edge_rule | ||||||||||||||
| = (lit("SAMEMETALSHAREDEDGE") >> double_ >> -string("ABOVE") | ||||||||||||||
| >> -(lit("CUTCLASS") >> _string) >> -string("EXCEPTTWOEDGES") | ||||||||||||||
| >> -(lit("EXCEPTSAMEVIA") >> int_))[boost::bind( | ||||||||||||||
| &addSameMetalSharedEdgeSubRule, _1, parser, layer, lefinReader)]; | ||||||||||||||
|
|
||||||||||||||
| qi::rule<std::string::const_iterator, space_type> AREA | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> area_rule | ||||||||||||||
| = (lit("AREA") | ||||||||||||||
| >> double_)[boost::bind(&addAreaSubRule, _1, parser, lefinReader)]; | ||||||||||||||
|
|
||||||||||||||
| qi::rule<std::string::const_iterator, space_type> LEF58_SPACING = (+( | ||||||||||||||
| qi::rule<std::string::const_iterator, space_type> lef58_spacing_rule = (+( | ||||||||||||||
| lit("SPACING") | ||||||||||||||
| >> double_[boost::bind(&setCutSpacing, _1, parser, layer, lefinReader)] | ||||||||||||||
| >> -(lit("MAXXY")[boost::bind(&addMaxXYSubRule, parser)] | ||||||||||||||
|
|
@@ -449,12 +450,13 @@ bool parse( | |||||||||||||
| >> -(lit("SAMENET")[boost::bind(&setSameNet, parser)] | ||||||||||||||
| | lit("SAMEMETAL")[boost::bind(&setSameMetal, parser)] | ||||||||||||||
| | lit("SAMEVIA")[boost::bind(&setSameVia, parser)]) | ||||||||||||||
| >> -(LAYER | ADJACENTCUTS | PARALLELOVERLAP | PARALLELWITHIN | ||||||||||||||
| | SAMEMETALSHAREDEDGE | AREA)) | ||||||||||||||
| >> -(layer_rule | adjacent_cuts_rule | parallel_overlap_rule | ||||||||||||||
| | parallel_within_rule | same_metal_shared_edge_rule | ||||||||||||||
| | area_rule)) | ||||||||||||||
| >> lit(";"))); | ||||||||||||||
|
|
||||||||||||||
| bool valid | ||||||||||||||
| = qi::phrase_parse(first, last, LEF58_SPACING, space) && first == last; | ||||||||||||||
| bool valid = qi::phrase_parse(first, last, lef58_spacing_rule, space) | ||||||||||||||
| && first == last; | ||||||||||||||
|
|
||||||||||||||
| if (!valid && parser->curRule != nullptr) { | ||||||||||||||
| if (!incomplete_props.empty() | ||||||||||||||
|
|
@@ -479,4 +481,4 @@ bool lefTechLayerCutSpacingParser::parse( | |||||||||||||
| s.begin(), s.end(), this, layer, l, incomplete_props); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| } // namespace odb | ||||||||||||||
| } // namespace odb | ||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -363,13 +363,13 @@ bool parse( | |||||||||||||||
| odb::lefinReader* lefinReader, | ||||||||||||||||
| std::vector<std::pair<odb::dbObject*, std::string>>& incomplete_props) | ||||||||||||||||
| { | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> ORTHOGONAL | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> orthogonal_rule | ||||||||||||||||
| = (lit("SPACINGTABLE") >> lit("ORTHOGONAL") | ||||||||||||||||
| >> +(lit("WITHIN") >> double_ >> lit("SPACING") >> double_) | ||||||||||||||||
| >> lit(";"))[boost::bind( | ||||||||||||||||
| &createOrthongonalSubRule, _1, parser, lefinReader)]; | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> LAYER | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> layer_rule | ||||||||||||||||
| = (lit("LAYER") >> _string[boost::bind( | ||||||||||||||||
| &setLayer, _1, parser, boost::ref(incomplete_props))] | ||||||||||||||||
| >> -lit("NOSTACK")[boost::bind(&setNoStack, parser)] | ||||||||||||||||
|
|
@@ -378,46 +378,47 @@ bool parse( | |||||||||||||||
| >> +(_string >> lit("TO") >> _string))[boost::bind( | ||||||||||||||||
| &setPrlForAlignedCut, _1, parser)])); | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> CENTERTOCENTER | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> center_to_center_rule | ||||||||||||||||
| = (lit("CENTERTOCENTER") | ||||||||||||||||
| >> +(_string >> lit("TO") | ||||||||||||||||
| >> _string))[boost::bind(&setCenterToCenter, _1, parser)]; | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> CENTERANDEDGE | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> center_and_edge_rule | ||||||||||||||||
| = (lit("CENTERANDEDGE") >> -lit("NOPRL")[boost::bind(&setNoPrl, parser)] | ||||||||||||||||
| >> (+(_string >> lit("TO") | ||||||||||||||||
| >> _string))[boost::bind(&setCenterAndEdge, _1, parser)]); | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> PRL | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> prl_rule | ||||||||||||||||
| = (lit("PRL") >> double_ >> -(string("HORIZONTAL") | string("VERTICAL")) | ||||||||||||||||
| >> -string("MAXXY") | ||||||||||||||||
| >> *(_string >> lit("TO") >> _string | ||||||||||||||||
| >> double_))[boost::bind(&setPRL, _1, parser, lefinReader)]; | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> EXTENSION | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> extension_rule | ||||||||||||||||
| = ((lit("ENDEXTENSION") >> double_ | ||||||||||||||||
| >> *(lit("TO") >> _string >> double_))[boost::bind( | ||||||||||||||||
| &setEndExtension, _1, parser, lefinReader)] | ||||||||||||||||
| >> -(lit("SIDEEXTENSION") | ||||||||||||||||
| >> +(lit("TO") >> _string >> double_))[boost::bind( | ||||||||||||||||
| &setSideExtension, _1, parser, lefinReader)]); | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> EXACTALIGNEDSPACING | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> exact_aligned_spacing_rule | ||||||||||||||||
| = (lit("EXACTALIGNEDSPACING") | ||||||||||||||||
| >> -(string("HORIZONTAL") | string("VERTICAL")) | ||||||||||||||||
| >> +(_string >> double_))[boost::bind( | ||||||||||||||||
| &setExactAlignedSpacing, _1, parser, lefinReader)]; | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> NONOPPOSITEENCLOSURESPACING | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> | ||||||||||||||||
| non_opposite_enclosure_spacing_rule | ||||||||||||||||
| = (lit("NONOPPOSITEENCLOSURESPACING") | ||||||||||||||||
|
Comment on lines
+409
to
411
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting is unconventional. A more standard way to break long declaration lines is to place the
Suggested change
|
||||||||||||||||
| >> +(_string >> double_))[boost::bind( | ||||||||||||||||
| &setNonOppositeEnclosureSpacing, _1, parser, lefinReader)]; | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> | ||||||||||||||||
| OPPOSITEENCLOSURERESIZESPACING | ||||||||||||||||
| opposite_enclosure_resize_spacing_rule | ||||||||||||||||
| = (lit("OPPOSITEENCLOSURERESIZESPACING") | ||||||||||||||||
|
Comment on lines
415
to
417
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This formatting is unconventional. A more standard way to break long declaration lines is to place the
Suggested change
|
||||||||||||||||
| >> +(_string >> double_ >> double_ >> double_))[boost::bind( | ||||||||||||||||
| &setOppositeEnclosureResizeSpacing, _1, parser, lefinReader)]; | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> CUTCLASS | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> cut_class_rule | ||||||||||||||||
| = (lit("CUTCLASS") | ||||||||||||||||
| >> +(_string | ||||||||||||||||
| >> -(string("SIDE") | ||||||||||||||||
|
|
@@ -430,21 +431,23 @@ bool parse( | |||||||||||||||
| | double_))) // REMAINING ROWS (3rd and below) | ||||||||||||||||
| )[boost::bind(&setCutClass, _1, parser, lefinReader)]; | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> DEFAULT | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> default_rule | ||||||||||||||||
| = (lit("SPACINGTABLE")[boost::bind(&createDefSubRule, parser)] | ||||||||||||||||
| >> -(lit("DEFAULT") | ||||||||||||||||
| >> double_[boost::bind(&setDefault, _1, parser, lefinReader)]) | ||||||||||||||||
| >> -lit("SAMEMASK")[boost::bind(&setSameMask, parser)] | ||||||||||||||||
| >> -(lit("SAMENET")[boost::bind(&setSameNet, parser)] | ||||||||||||||||
| | lit("SAMEMETAL")[boost::bind(&setSameMetal, parser)] | ||||||||||||||||
| | lit("SAMEVIA")[boost::bind(&setSameVia, parser)]) | ||||||||||||||||
| >> -LAYER >> -CENTERTOCENTER >> -CENTERANDEDGE >> -PRL >> -EXTENSION | ||||||||||||||||
| >> -EXACTALIGNEDSPACING >> -NONOPPOSITEENCLOSURESPACING | ||||||||||||||||
| >> -OPPOSITEENCLOSURERESIZESPACING >> CUTCLASS >> lit(";")); | ||||||||||||||||
| >> -layer_rule >> -center_to_center_rule >> -center_and_edge_rule | ||||||||||||||||
| >> -prl_rule >> -extension_rule >> -exact_aligned_spacing_rule | ||||||||||||||||
| >> -non_opposite_enclosure_spacing_rule | ||||||||||||||||
| >> -opposite_enclosure_resize_spacing_rule >> cut_class_rule | ||||||||||||||||
| >> lit(";")); | ||||||||||||||||
|
|
||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> LEF58_SPACINGTABLE | ||||||||||||||||
| = (+(ORTHOGONAL | DEFAULT)); | ||||||||||||||||
| bool valid = qi::phrase_parse(first, last, LEF58_SPACINGTABLE, space) | ||||||||||||||||
| qi::rule<std::string::const_iterator, space_type> lef58_spacing_table_rule | ||||||||||||||||
| = (+(orthogonal_rule | default_rule)); | ||||||||||||||||
| bool valid = qi::phrase_parse(first, last, lef58_spacing_table_rule, space) | ||||||||||||||||
| && first == last; | ||||||||||||||||
| if (!valid && parser->curRule != nullptr) { | ||||||||||||||||
| if (!incomplete_props.empty() | ||||||||||||||||
|
|
@@ -469,4 +472,4 @@ bool lefTechLayerCutSpacingTableParser::parse( | |||||||||||||||
| s.begin(), s.end(), this, l, incomplete_props); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| } // namespace odb | ||||||||||||||||
| } // namespace odb | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line break before the assignment operator is unconventional and harms readability. It's better to keep the declaration and assignment on one line. If the line is too long, it should be broken after an operator like
&&, which is the pattern used in other files in this PR.