The road to better programming: Chapter 9. The classes and default parsers
The define_group() function
The global (and thus external to the groups
section parser) define_group()
function takes two arguments. The first is the name of the new class
that may be defined, and the second is an array reference to existing
class names.
Parse::RecDescent
could have done
the class name validation automatically, but an external function is
easier to code and understand, in my opinion.
|
Note the "next unless" control flow and the way we invoke return()
on a successful match for the fastest possible traversal of the @$conditional_names
array.
View The road to better programming: Chapter 9. The classes and default parsers Discussion
Page: 1 2 3 4 5 6 Next Page: Conclusion and ResourcesFirst published by IBM developerWorks