Exporter |
NaturalDocs::Languages::Simple |
A class containing the characteristics of a particular programming language for basic support within Natural Docs. Also serves as a base class for languages that break from general conventions, such as not having parameter lists use parenthesis and commas.
NaturalDocs:: | A class containing the characteristics of a particular programming language for basic support within Natural Docs. |
@EXPORT | |
New | Creates and returns a new object. |
LineCommentSymbols | Returns an arrayref of symbols that start a line comment, or undef if none. |
SetLineCommentSymbols | Replaces the arrayref of symbols that start a line comment. |
BlockCommentSymbols | Returns an arrayref of start/end symbol pairs that specify a block comment, or undef if none. |
SetBlockCommentSymbols | Replaces the arrayref of start/end symbol pairs that specify a block comment. |
LineExtender | Returns the symbol to ignore a line break in languages where line breaks are significant. |
SetLineExtender | Replaces the symbol to ignore a line break in languages where line breaks are significant. |
PackageSeparator | Returns the package separator symbol. |
PackageSeparatorWasSet | Returns whether the package separator symbol was ever changed from the default. |
SetPackageSeparator | Replaces the language’s package separator string. |
EnumValues | Returns the EnumValuesType that describes how the language handles enums. |
EnumValuesWasSet | Returns whether EnumValues was ever changed from the default. |
SetEnumValues | Replaces the EnumValuesType that describes how the language handles enums. |
PrototypeEndersFor | Returns an arrayref of prototype ender symbols for the passed TopicType, or undef if none. |
SetPrototypeEndersFor | Replaces the arrayref of prototype ender symbols for the passed TopicType. |
Parsing Functions | |
ParseFile | Parses the passed source file, sending comments acceptable for documentation to NaturalDocs::Parser->OnComment() and all other sections to OnCode(). |
OnCode | Called whenever a section of code is encountered by the parser. |
OnPrototypeEnd | Called whenever the end of a prototype is found so that there’s a chance for derived classes to mark false positives. |
RemoveLineExtender | If the passed line has a line extender, returns it without the extender or the line break that follows. |
sub SetEnumValues #( EnumValuesType newBehavior )
Returns the EnumValuesType that describes how the language handles enums.
Returns whether EnumValues was ever changed from the default.
Replaces the EnumValuesType that describes how the language handles enums.
sub PrototypeEndersFor #( type )
Returns an arrayref of prototype ender symbols for the passed TopicType, or undef if none.
sub SetPrototypeEndersFor #( type, enders )
Replaces the arrayref of prototype ender symbols for the passed TopicType.
sub ParseFile #( sourceFile, topicsList )
Parses the passed source file, sending comments acceptable for documentation to NaturalDocs::Parser->OnComment() and all other sections to OnCode().
sourceFile | The FileName of the source file to parse. |
topicList | A reference to the list of NaturalDocs::Parser::ParsedTopics being built by the file. |
Since this class cannot automatically document the code or generate a scope record, it always returns ( undef, undef ).
sub OnCode #( codeLines, codeLineNumber, topicList, lastCommentTopicCount )
Called whenever a section of code is encountered by the parser. Is used to find the prototype of the last topic created.
codeLines | The source code as an arrayref of lines. |
codeLineNumber | The line number of the first line of code. |
topicList | A reference to the list of NaturalDocs::Parser::ParsedTopics being built by the file. |
lastCommentTopicCount | The number of Natural Docs topics that were created by the last comment. |
sub OnPrototypeEnd #( type, prototypeRef, ender )
Called whenever the end of a prototype is found so that there’s a chance for derived classes to mark false positives.
type | The TopicType of the prototype. |
prototypeRef | A reference to the prototype so far, minus the ender in dispute. |
ender | The ender symbol. |
ENDER_ACCEPT | The ender is accepted and the prototype is finished. |
ENDER_IGNORE | The ender is rejected and parsing should continue. Note that the prototype will be rejected as a whole if all enders are ignored before reaching the end of the code. |
ENDER_ACCEPT_AND_CONTINUE | The ender is accepted so the prototype may stand as is. However, the prototype might also continue on so continue parsing. If there is no accepted ender between here and the end of the code this version will be accepted instead. |
ENDER_REVERT_TO_ACCEPTED | The expedition from ENDER_ACCEPT_AND_CONTINUE failed. Use the last accepted version and end parsing. |
our @EXPORT
Creates and returns a new object.
sub New #( name )
Returns the package separator symbol.
sub SetPackageSeparator #( separator )
Returns the EnumValuesType that describes how the language handles enums.
sub SetEnumValues #( EnumValuesType newBehavior )
Returns an arrayref of prototype ender symbols for the passed TopicType, or undef if none.
sub PrototypeEndersFor #( type )
Replaces the arrayref of prototype ender symbols for the passed TopicType.
sub SetPrototypeEndersFor #( type, enders )
Parses the passed source file, sending comments acceptable for documentation to NaturalDocs::Parser->OnComment() and all other sections to OnCode().
sub ParseFile #( sourceFile, topicsList )
The function called by NaturalDocs::Languages::Base-derived objects when their parsers encounter a comment suitable for documentation.
sub OnComment #( string[] commentLines, int lineNumber, bool isJavaDoc )
Called whenever a section of code is encountered by the parser.
sub OnCode #( codeLines, codeLineNumber, topicList, lastCommentTopicCount )
Called whenever the end of a prototype is found so that there’s a chance for derived classes to mark false positives.
sub OnPrototypeEnd #( type, prototypeRef, ender )
If the passed line has a line extender, returns it without the extender or the line break that follows.
sub RemoveLineExtender #( line )