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.

Summary
NaturalDocs::Languages::SimpleA class containing the characteristics of a particular programming language for basic support within Natural Docs.
@EXPORT
NewCreates and returns a new object.
LineCommentSymbolsReturns an arrayref of symbols that start a line comment, or undef if none.
SetLineCommentSymbolsReplaces the arrayref of symbols that start a line comment.
BlockCommentSymbolsReturns an arrayref of start/end symbol pairs that specify a block comment, or undef if none.
SetBlockCommentSymbolsReplaces the arrayref of start/end symbol pairs that specify a block comment.
LineExtenderReturns the symbol to ignore a line break in languages where line breaks are significant.
SetLineExtenderReplaces the symbol to ignore a line break in languages where line breaks are significant.
PackageSeparatorReturns the package separator symbol.
PackageSeparatorWasSetReturns whether the package separator symbol was ever changed from the default.
SetPackageSeparatorReplaces the language’s package separator string.
EnumValuesReturns the EnumValuesType that describes how the language handles enums.
EnumValuesWasSetReturns whether EnumValues was ever changed from the default.
SetEnumValuesReplaces the EnumValuesType that describes how the language handles enums.
PrototypeEndersForReturns an arrayref of prototype ender symbols for the passed TopicType, or undef if none.
SetPrototypeEndersForReplaces the arrayref of prototype ender symbols for the passed TopicType.
Parsing Functions
ParseFileParses the passed source file, sending comments acceptable for documentation to NaturalDocs::Parser->OnComment() and all other sections to OnCode().
OnCodeCalled whenever a section of code is encountered by the parser.
OnPrototypeEndCalled whenever the end of a prototype is found so that there’s a chance for derived classes to mark false positives.
RemoveLineExtenderIf the passed line has a line extender, returns it without the extender or the line break that follows.

@EXPORT

our @EXPORT

New

sub New #(name)

Creates and returns a new object.

Parameters

nameThe name of the language.

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.  Pairs are specified with two consecutive array entries.

SetBlockCommentSymbols

Replaces the arrayref of start/end symbol pairs that specify a block comment.  Pairs are specified with two consecutive array entries.

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

sub SetPackageSeparator #(separator)

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

sub SetEnumValues #(EnumValuesType newBehavior)

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

sub PrototypeEndersFor #(type)

Returns an arrayref of prototype ender symbols for the passed TopicType, or undef if none.

SetPrototypeEndersFor

sub SetPrototypeEndersFor #(type,
enders)

Replaces the arrayref of prototype ender symbols for the passed TopicType.

Parsing Functions

ParseFile

sub ParseFile #(sourceFile,
topicsList)

Parses the passed source file, sending comments acceptable for documentation to NaturalDocs::Parser->OnComment() and all other sections to OnCode().

Parameters

sourceFileThe FileName of the source file to parse.
topicListA reference to the list of NaturalDocs::Parser::ParsedTopics being built by the file.

Returns

Since this class cannot automatically document the code or generate a scope record, it always returns ( undef, undef ).

OnCode

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.

Parameters

codeLinesThe source code as an arrayref of lines.
codeLineNumberThe line number of the first line of code.
topicListA reference to the list of NaturalDocs::Parser::ParsedTopics being built by the file.
lastCommentTopicCountThe number of Natural Docs topics that were created by the last comment.

OnPrototypeEnd

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.

Parameters

typeThe TopicType of the prototype.
prototypeRefA reference to the prototype so far, minus the ender in dispute.
enderThe ender symbol.

Returns

ENDER_ACCEPTThe ender is accepted and the prototype is finished.
ENDER_IGNOREThe 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_CONTINUEThe 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_ACCEPTEDThe expedition from ENDER_ACCEPT_AND_CONTINUE failed.  Use the last accepted version and end parsing.

RemoveLineExtender

sub RemoveLineExtender #(line)

If the passed line has a line extender, returns it without the extender or the line break that follows.  If it doesn’t, or there are no line extenders defined, returns the passed line unchanged.

A base class for all programming language parsers.
A subclass to handle the language variations of Ada
A subclass to handle the language variations of Pascal and Delphi.
A subclass to handle the language variations of PL/SQL.
A subclass to handle the language variations of Tcl.
our @EXPORT
sub New #(name)
Creates and returns a new object.
sub SetPackageSeparator #(separator)
Returns the package separator symbol.
sub SetEnumValues #(EnumValuesType newBehavior)
Returns the EnumValuesType that describes how the language handles enums.
How enum values are handled in the language.
sub PrototypeEndersFor #(type)
Returns an arrayref of prototype ender symbols for the passed TopicType, or undef if none.
A string representing a topic type as defined in Topics.txt.
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().
sub OnComment #(string[] commentLines,
int lineNumber,
bool isJavaDoc)
The function called by NaturalDocs::Languages::Base-derived objects when their parsers encounter a comment suitable for documentation.
sub OnCode #(codeLines,
codeLineNumber,
topicList,
lastCommentTopicCount)
Called whenever a section of code is encountered by the parser.
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.
sub RemoveLineExtender #(line)
If the passed line has a line extender, returns it without the extender or the line break that follows.
A string representing the absolute, platform-dependent path to a file.
A class for parsed topics of source files.
Close