NaturalDocs:: Languages:: Language

A class containing the characteristics of a particular programming language. 

Summary
A class containing the characteristics of a particular programming language.
The class is implemented as a blessed arrayref.
Returns a new language object.
Returns the symbol used to start a single line comment, or undef if none.
Returns the symbol used to start a multi-line comment, or undef if none.
Returns the symbol used to end a multi-line comment, or undef if none.
Returns whether the entire file should be treated as one big comment.
Returns an arrayref of the symbols that end a function prototype, or undef if not applicable.
Returns an arrayref of the symbols that end a variable declaration, or undef if not applicable.
Returns the index of the end of the function prototype in a string.
Returns the index of the end of the variable declaration in a string.
Returns the index of the end of an arbitrary prototype in a string.

Implementation

Members

The class is implemented as a blessed arrayref.  The following constants are used as indexes. 

LINE_COMMENTThe symbol that starts a single line comment.  Undef if none. 
START_COMMENTThe symbol that starts a multi-line comment.  Undef if none. 
END_COMMENTThe symbol that ends a multi-line comment.  Undef if none. 
FUNCTION_ENDERSAn arrayref of symbols that can end a function prototype.  Undef if not applicable. 
VARIABLE_ENDERSAn arrayref of symbols that can end a variable declaration.  Undef if not applicable. 

Functions

New

sub New #(lineComment, startComment, endComment, functionEnders, variableEnders)

Returns a new language object. 

Parameters

lineCommentThe symbol that starts a single-line comment.  Undef if none. 
startCommentThe symbol that starts a multi-line comment.  Undef if none. 
endCommentThe symbol that starts a multi-line comment.  Undef if none. 
functionEndersAn arrayref of symbols that can end a function prototype.  Undef if not applicable. 
variableEndersAn arrayref of symbols that can end a variable declaration.  Undef if not applicable. 

LineComment

sub LineComment

Returns the symbol used to start a single line comment, or undef if none. 

StartComment

sub StartComment

Returns the symbol used to start a multi-line comment, or undef if none. 

EndComment

sub EndComment

Returns the symbol used to end a multi-line comment, or undef if none. 

FileIsComment

sub FileIsComment

Returns whether the entire file should be treated as one big comment. 

FunctionEnders

sub FunctionEnders

Returns an arrayref of the symbols that end a function prototype, or undef if not applicable. 

VariableEnders

sub VariableEnders

Returns an arrayref of the symbols that end a variable declaration, or undef if not applicable. 

EndOfFunction

sub EndOfFunction #(stringRef, startingIndex optional)

Returns the index of the end of the function prototype in a string. 

Parameters

stringRefA reference to the string. 
startingIndexOptional.  The starting index.  If not specified, starts at the beginning of the string. 

Returns

The zero-based offset into the string of the end of the prototype, or -1 if the string doesn’t contain a symbol from FunctionEnders()

EndOfVariable

sub EndOfVariable #(stringRef, startingIndex optional)

Returns the index of the end of the variable declaration in a string. 

Parameters

stringRefA reference to the string. 
startingIndexOptional.  The starting index.  If not specified, starts at the beginning of the string. 

Returns

The zero-based offset into the string of the end of the declaration, or -1 if the string doesn’t contain a symbol from VariableEnders()

Support Functions

EndOfPrototype

sub EndOfPrototype #(stringRef, startingIndex, symbols)

Returns the index of the end of an arbitrary prototype in a string. 

Parameters

stringRefA reference to the string. 
startingIndexThe starting index.  If undef, starts at the beginning of the string. 
symbolsAn arrayref of the symbols that can end the prototype. 

Returns

The zero-based offset into the string of the end of the prototype, or -1 if the string doesn’t contain a symbol from the arrayref.