Libraries |
|
Scanfile | Source Code |
|
|
Function Summary | |||||
void |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
string |
| ||||
void |
| ||||
void |
| ||||
void |
| ||||
string |
| ||||
void |
| ||||
string |
|
Function Detail |
skipComment
const proc: skipComment (inout file: inFile)
-
Skips a possibly nested comment from a file. The comment starts with (* and ends with *) . When the function is called it is assumed that inFile.bufferChar contains the '*' of the comment start. When the function is left the character after ')' is in inFile.bufferChar.
getComment
const func string: getComment (inout file: inFile)
-
Reads a possibly nested comment from a file. The comment starts with (* and ends with *) . When the function is called it is assumed that inFile.bufferChar contains the '*' of the comment start. When the function is left the character after ')' is in inFile.bufferChar.
- Returns:
- the content of the comment, including the introducing (* and the ending *) .
skipClassicComment
const proc: skipClassicComment (inout file: inFile)
-
Skips a classic C comment from a file. The comment starts with /* and ends with */ . In a classic C comment no nesting of comments is allowed. When the function is called it is assumed that inFile.bufferChar contains the '*' of the comment start. When the function is left the character after '/' is in inFile.bufferChar.
skipLineComment
const proc: skipLineComment (inout file: inFile)
-
Skips a line comment from a file. A line comment starts with an introducing character (like '#') and ends with the end of the line. When the function is called it is assumed that the introducing character (e.g. '#') is in inFile.bufferChar. When the function is left the line end character ('\n' or EOF) is in inFile.bufferChar.
getLineComment
const func string: getLineComment (inout file: inFile)
-
Reads a line comment from a file. A line comment starts with an introducing character (like '#') and ends with the end of the line. When the function is called it is assumed that the introducing character (e.g. '#') is in inFile.bufferChar. When the function is left the line end character ('\n' or EOF) is in inFile.bufferChar.
- Returns:
- the content of the comment, including the start marker (e.g. '#') but without line end character ('\n', or EOF).
getDigits
const func string: getDigits (inout file: inFile)
-
Reads a sequence of digits from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the digits.
f := initScan("12"); getDigits(f) returns "12" and f.bufferChar = EOF f := initScan("12ab"); getDigits(f) returns "12" and f.bufferChar = 'a' f := initScan("ab"); getDigits(f) returns "" and f.bufferChar = 'a' f := initScan(" 12"); getDigits(f) returns "" and f.bufferChar = ' '
- Returns:
- the digit sequence, and "" if no digit was found.
getHexDigits
const func string: getHexDigits (inout file: inFile)
-
Reads a sequence of hexadecimal digits from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the hexadecimal digits.
f := initScan("1f"); getHexDigits(f) returns "1f" and f.bufferChar = EOF f := initScan("1ag"); getHexDigits(f) returns "1a" and f.bufferChar = 'g' f := initScan("gx"); getHexDigits(f) returns "" and f.bufferChar = 'g' f := initScan(" 1a"); getHexDigits(f) returns "" and f.bufferChar = ' '
- Returns:
- the digit sequence, and "" if no digit was found.
getInteger
const func string: getInteger (inout file: inFile)
-
Reads a decimal integer with optional sign from a file. A decimal integer accepted by getInteger consists of an optional + or - sign followed by a possibly empty sequence of digits. Because of the LL(1) approach, a sign without following digits is accepted. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the integer.
f := initScan("123*2"); getInteger(f) returns "123" and f.bufferChar = '*' f := initScan("+1-2"); getInteger(f) returns "+1" and f.bufferChar = '-' f := initScan("-2+3"); getInteger(f) returns "-2" and f.bufferChar = '+' f := initScan("+-0"); getInteger(f) returns "+" and f.bufferChar = '-' f := initScan("pi"); getInteger(f) returns "" and f.bufferChar = 'p'
- Returns:
- the decimal integer string, and "" if no integer was found.
getNumber
const func string: getNumber (inout file: inFile)
-
Reads a numeric literal (integer, bigInteger or float literal) from a file. When the function is called it is assumed that the introducing digit is in inFile.bufferChar. When the function is left the character after the literal is in inFile.bufferChar.
f := initScan("1x"); getNumber(f) returns "1" and f.bufferChar = 'x' f := initScan("1.0+"); getNumber(f) returns "1.0" and f.bufferChar = '+' f := initScan("1.0E1-"); getNumber(f) returns "1.0E1" and f.bufferChar = '-' f := initScan("1.0e-1"); getNumber(f) returns "1.0e-1" and f.bufferChar = EOF f := initScan("2#101*"); getNumber(f) returns "2#101" and f.bufferChar = '*' f := initScan("1e2y"); getNumber(f) returns "1e2" and f.bufferChar = 'y' f := initScan("1E+3z"); getNumber(f) returns "1E+3" and f.bufferChar = 'z' f := initScan("1234_/"); getNumber(f) returns "1234_" and f.bufferChar = '/'
- Returns:
- The function returns the numeric literal.
getNonDigits
const func string: getNonDigits (inout file: inFile)
-
Reads a sequence of non digits from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains a digit or EOF.
f := initScan("1+2"); getNonDigits(f) returns "" and f.bufferChar = '1' f := initScan(" 1+2"); getNonDigits(f) returns " " and f.bufferChar = '1' f := initScan("-1+2"); getNonDigits(f) returns "-" and f.bufferChar = '1' f := initScan("a+2"); getNonDigits(f) returns "a+" and f.bufferChar = '2'
- Returns:
- the non digit sequence, and "" if a digit was found.
getQuotedText
const func string: getQuotedText (inout file: inFile)
-
Reads a text quoted with characters like " and ' from a file. The introducing and the closing quoting character must be identical. When the function is called it is assumed that inFile.bufferChar contains the introducing quoting character (which can be any character). When the function is left inFile.bufferChar contains the character after the closing quoting character.
f := initScan("'ab'+"); getQuotedText(f) returns "ab" and f.bufferChar = '+' f := initScan("''=a"); getQuotedText(f) returns "" and f.bufferChar = '=' f := initScan("\"A\""); getQuotedText(f) returns "A" and f.bufferChar = EOF f := initScan("\"\"?"); getQuotedText(f) returns "" and f.bufferChar = '?' f := initScan(":ab:5"); getQuotedText(f) returns "ab" and f.bufferChar = '5' f := initScan("+XY"); getQuotedText(f) returns "XY" and f.bufferChar = EOF
- Returns:
- the quoted text without introducing or closing characters ( " or ' ).
getSimpleStringLiteral
const func string: getSimpleStringLiteral (inout file: inFile)
-
Read a simple string literal from a file. A simple string literal is enclosed in delimiter characters (e.g. " or ' ). Delimiter characters within the simple string literal must be doubled. A simple string literal does not support an escape character. All characters, including control characters (e.g. linefeed) are allowed inside a simple string literal. When the function is called it is assumed that inFile.bufferChar contains the introducing delimiter character. When the function is left the character after the closing delimiter character is in inFile.bufferChar.
f := initScan("\"\""); getSimpleStringLiteral(f) = "\"\"" and f.bufferChar = EOF f := initScan("\"\"x"); getSimpleStringLiteral(f) = "\"\"" and f.bufferChar = 'x' f := initScan("\"\"\""); getSimpleStringLiteral(f) = "\"\"\"" and f.bufferChar = EOF f := initScan("\"\"\"\""); getSimpleStringLiteral(f) = "\"\"\"" and f.bufferChar = EOF f := initScan("\"a\"\"\""); getSimpleStringLiteral(f) = "\"a\"\"" and f.bufferChar = EOF f := initScan("\"\"\"b\""); getSimpleStringLiteral(f) = "\"\"b\"" and f.bufferChar = EOF f := initScan("\"a\"\"b\""); getSimpleStringLiteral(f) = "\"a\"b\"" and f.bufferChar = EOF f := initScan("\"\"\"\"x"); getSimpleStringLiteral(f) = "\"\"\"" and f.bufferChar = 'x' f := initScan("\"a\"\"\"x"); getSimpleStringLiteral(f) = "\"a\"\"" and f.bufferChar = 'x' f := initScan("\"\"\"b\"x"); getSimpleStringLiteral(f) = "\"\"b\"" and f.bufferChar = 'x' f := initScan("\"a\"\"b\"x"); getSimpleStringLiteral(f) = "\"a\"b\"" and f.bufferChar = 'x'
- Returns:
- the string literal including the introducing and closing delimiter character. Double delimiter chars in the literal are converted to single delimiter chars.
getEscapeSequence
const proc: getEscapeSequence (inout file: inFile, inout string: symbol)
-
Reads an escape sequence from inFile and appends it to symbol. The function accepts escape sequences from character and string literals. When the function is called it is assumed that the introducing \ is in inFile.bufferChar. When the function is left the character after the escape sequence is in inFile.bufferChar. The complete escape sequence including the introducing \ is appended to symbol.
getCharLiteral
const func string: getCharLiteral (inout file: inFile)
-
Reads a character literal from a file. When the function is called it is assumed that the introducing ' is in inFile.bufferChar. When the function is left the character after the closing ' is in inFile.bufferChar.
- Returns:
- the character literal including the introducing ' and the closing ' .
getStringLiteral
const func string: getStringLiteral (inout file: inFile)
getLetters
const func string: getLetters (inout file: inFile)
-
Reads a sequence of letters from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the letters.
f := initScan("test"); getLetters(f) returns "test" and f.bufferChar = EOF f := initScan("test1"); getLetters(f) returns "test" and f.bufferChar = '1' f := initScan("test+1"); getLetters(f) returns "test" and f.bufferChar = '+' f := initScan("+1"); getLetters(f) returns "" and f.bufferChar = '+'
- Returns:
- the letter sequence, and "" if no letter was found.
getName
const func string: getName (inout file: inFile)
-
Reads an alphanumeric name from a file. A name consists of a letter or underscore followed by letters, digits or underscores. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the name.
f := initScan("test"); getName(f) returns "test" and f.bufferChar = EOF f := initScan("test1"); getName(f) returns "test1" and f.bufferChar = EOF f := initScan("test+1"); getName(f) returns "test" and f.bufferChar = '+' f := initScan("+1"); getName(f) returns "" and f.bufferChar = '+'
- Returns:
- the name, and "" if no letter or underscore was found.
skipSpace
const proc: skipSpace (inout file: inFile)
-
Skips space characters from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar does not contain a space character.
f := initScan(" ok"); skipSpace(f); afterwards f.bufferChar = 'o' f := initScan(" "); skipSpace(f); afterwards f.bufferChar = EOF f := initScan("ok "); skipSpace(f); afterwards f.bufferChar = 'o'
skipSpaceOrTab
const proc: skipSpaceOrTab (inout file: inFile)
-
Skips space and tab characters from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the sequence of space and tab characters.
f := initScan("\t x"); skipSpaceOrTab(f); afterwards f.bufferChar = 'x' f := initScan("\t "); skipSpaceOrTab(f); afterwards f.bufferChar = EOF f := initScan("abc "); skipSpaceOrTab(f); afterwards f.bufferChar = 'a'
skipWhiteSpace
const proc: skipWhiteSpace (inout file: inFile)
-
Skips whitespace characters from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the whitespace characters.
f := initScan("\t\n\r X"); skipWhiteSpace(f); afterwards f.bufferChar = 'X' f := initScan("\t\n\r "); skipWhiteSpace(f); afterwards f.bufferChar = EOF f := initScan("X "); skipWhiteSpace(f); afterwards f.bufferChar = 'X'
skipWhiteSpace
const proc: skipWhiteSpace (inout file: inFile, in set of char: whiteSpaceChar)
-
Skips characters from the set whiteSpaceChar from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the whitespace characters.
getWhiteSpace
const func string: getWhiteSpace (inout file: inFile)
-
Reads whitespace characters from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the whitespace characters.
f := initScan("\t X"); getWhiteSpace(f) returns "\t " and f.bufferChar = 'X' f := initScan("\r\n"); getWhiteSpace(f) returns "\r\n" and f.bufferChar = EOF f := initScan("X "); getWhiteSpace(f) returns "" and f.bufferChar = 'X'
- Returns:
- the string of whitespace characters, and "" if no whitespace character was found.
getWord
const func string: getWord (inout file: inFile)
-
Reads a white space delimited word from a file. Before reading the word it skips whitespace characters. A word is a sequence of characters which does not contain a whitespace character. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the word.
f := initScan(" ab"); getWord(f) returns "ab" and f.bufferChar = EOF f := initScan(" ab "); getWord(f) returns "ab" and f.bufferChar = ' ' f := initScan("ab\t"); getWord(f) returns "ab" and f.bufferChar = '\t'
- Returns:
- the word, and "" if no word was found.
getWord
const func string: getWord (inout file: inFile, in set of char: wordChars)
-
Reads a word consisting of wordChars from a file. Before reading the word it skips non-wordChars characters. A word is a sequence of wordChars characters. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left inFile.bufferChar contains the character after the word.
f := initScan(" a1"); getWord(f, alphanum_char) returns "a1" and f.bufferChar = EOF f := initScan("-a2."); getWord(f, alphanum_char) returns "a2" and f.bufferChar = '.' f := initScan("=a3,"); getWord(f, alphanum_char) returns "a3" and f.bufferChar = ',' f := initScan("a4\t"); getWord(f, alphanum_char) returns "a4" and f.bufferChar = '\t' f := initScan(", a5"); getWord(f, alphanum_char) returns "a5" and f.bufferChar = EOF
- Returns:
- the word, and "" if no word was found.
skipLine
const proc: skipLine (inout file: inFile)
-
Skips a line from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left the line end character ('\n' or EOF) is in inFile.bufferChar. If inFile.bufferChar already contains a line end character ('\n' or EOF) nothing is done.
getLine
const func string: getLine (inout file: inFile)
-
Reads a line from a file. When the function is called it is assumed that inFile.bufferChar contains the first character to be handled. When the function is left the line end character ('\n' or EOF) is in inFile.bufferChar. A sequence of "\r\n" is interpreted as equal to '\n'. If inFile.bufferChar already contains a line end character ('\n' or EOF) nothing is done and the function returns "" .
- Returns:
- the line read, and "" if inFile.bufferChar contains '\n' or EOF.
getSymbolOrComment
const func string: getSymbolOrComment (inout file: inFile)
-
Reads a symbol or a comment from a file. Before reading the symbol or comment it skips whitespace characters. A symbol can be a literal (numeric, character or string), a name, a special symbol (sequence of special characters) or a parenthesis. A comment can be a normal comment or a line comment. When the function is called it is assumed that inFile.bufferChar contains a whitespace character or the first character of a symbol or comment. When the function is left the character after the symbol or comment is in inFile.bufferChar.
- Returns:
- the symbol or comment, and "" if EOF was reached.
getSymbol
const func string: getSymbol (inout file: inFile)
-
Reads a symbol from a file. Before reading the symbol it skips whitespace characters and comments (normal comments and line comments). A symbol can be a literal (numeric, character or string), a name, a special symbol (sequence of special characters) or a parenthesis. When the function is called it is assumed that inFile.bufferChar contains a whitespace character or the first character of a symbol or comment. When the function is left the character after the symbol is in inFile.bufferChar.
- Returns:
- the symbol, and "" if EOF was reached.
getSymbolWithHtmlEntities
const func string: getSymbolWithHtmlEntities (inout file: inFile)
-
Reads a symbol, where html entities are allowed, from a file. Before reading the symbol it skips whitespace characters and comments (normal comments and line comments). A symbol can be a literal (numeric, character or string), a name, a special symbol (sequence of special characters) or a parenthesis. Html entities in the file are treated as special characters. When the function is called it is assumed that inFile.bufferChar contains a whitespace character or the first character of a symbol or comment. When the function is left the character after the symbol is in inFile.bufferChar.
- Returns:
- the symbol, and "" if EOF was reached.
getHtmlTagSymbolOrComment
const func string: getHtmlTagSymbolOrComment (inout file: inFile)
-
Reads a HTML tag, a symbol or a comment from a file. Before reading the HTML tag, symbol or comment it skips whitespace characters. A HTML tag starts with < and ends with > . A symbol can be a literal (numeric, character or string), a name, a special symbol (sequence of special characters) or a parenthesis. A comment can be a normal comment or a line comment. Html entities in the file are treated as special characters. When the function is called it is assumed that inFile.bufferChar contains a whitespace character, an introducing < of a HTML tag or the first character of a symbol or a comment. When the function is left the character after the HTML tag, symbol or comment is in inFile.bufferChar.
- Returns:
- the HTML tag, symbol or comment, and "" if EOF was reached.
skipXmlComment
const proc: skipXmlComment (inout file: inFile)
-
Skips an XML comment from a file. The XML comment starts with <!-- and ends with --> . When the function is called it is assumed that the character in inFile.bufferChar is the last '-' of the introducing <!-- . When the function is left the character after --> is in inFile.bufferChar.
getXmlTagOrContent
const func string: getXmlTagOrContent (inout file: inFile)
-
Reads an XML/HTML tag or the XML/HTML content text from a file. An XML/HTML tag starts with < and ends with > . The content text starts with everything else and ends just before a < or with EOF. When the function is called it is assumed that inFile.bufferChar contains the introducing < of an XML/HTML tag or the first character of the content text. When the function is left the character after the XML/HTML tag or the content text is in inFile.bufferChar.
- Returns:
- the XML/HTML tag or XML/HTML content text, and "" if EOF was reached.
getXmlCharacterReference
const func string: getXmlCharacterReference (inout file: inFile)
getXmlCdataContent
const func string: getXmlCdataContent (inout file: inFile)
-
Read the content text of a CDATA section. In a CDATA section the text between <![CDATA[ and ]]> is considered content text. Inside a CDATA section the characters < and & have no special meaning. All occurances of < and & inside CDATA are returned as < and & respectively. When the function is called it is assumed that inFile.bufferChar contains the first character after the introducing <![CDATA[ sequence or EOF. When the function is left inFile.bufferChar contains the character after the final ]]> sequence or EOF.
- Parameters:
- inFile - Input file
- Returns:
- the content text of the CDATA section that has been read.
getXmlTagHeadOrContent
const func string: getXmlTagHeadOrContent (inout file: inFile)
-
Reads an XML/HTML tag head or an XML/HTML content from a file. Examples of XML/HTML tag heads are:
<html <meta <table </span
Before reading a tag head or content, it skips whitespace characters and XML comments. An XML/HTML tag head starts with < and ends before a > or a / or a whitespace character or EOF. The content text starts with a non whitespace character and ends just before a < or EOF. Content text can be also in a CDATA section. In a CDATA section the text between <![CDATA[ and ]]> is considered content text. Inside a CDATA section the characters < and & have no special meaning. All occurances of < and & inside CDATA are returned as < and & respectively. When the function is called it is assumed that inFile.bufferChar contains either a whitespace character, the introducing < of an XML/HTML tag or the first character of the content text. When the function is left, the character after the XML/HTML tag head or the content text is in inFile.bufferChar. Text between <!-- and --> is considered an XML comment. An XML comment is ignored and getXmlTagHeadOrContent() is called recursive. The function can be used as follows:
symbol := getXmlTagHeadOrContent(inFile); if startsWith(symbol, "</") then ... handle the XML/HTML end-tag ... elsif startsWith(symbol, "<") then ... handle the attributes of the XML/HTML start-tag ... else ... handle the content text ... end if;
- Parameters:
- inFile - Input file
- Returns:
- the XML/HTML tag head or XML/HTML content text, and "" if EOF was reached.
getSymbolInXmlTag
const func string: getSymbolInXmlTag (inout file: inFile)
-
Reads a symbol which can appear inside an XML/HTML tag from a file. Before reading the symbol it skips whitespace characters. A symbol inside an XML/HTML tag can be a name, a string literal (quoted with " or ' ), the equals sign (=), the end of tag character (>), the slash character (/) or a special symbol (a sequence of characters that does not include the character > or a whitespace character). Special symbols can only appear in HTML tags. When the function is called it is assumed that inFile.bufferChar contains a whitespace character or the first character of a symbol. When the function is left inFile.bufferChar contains the character after the XML/HTML symbol or EOF.
- Parameters:
- inFile - Input file
- Returns:
- the symbol, and "" if EOF was reached.
skipXmlTag
const proc: skipXmlTag (inout file: inFile)
-
Skips beyond an XML Tag in a file. When the function is left the character after '>' is in inFile.bufferChar.
skipXmlTag
const proc: skipXmlTag (inout file: inFile, in var string: symbol)
-
Skips beyond an XML Tag in a file. The parameter symbol is used to provide the current symbol which possibly can be ">" or "". When the function is left the character after '>' is in inFile.bufferChar.
getNextXmlAttribute
const proc: getNextXmlAttribute (inout file: inFile, inout string: attributeName, inout string: attributeValue)
-
Reads name and value of an attribute inside an XML tag from a file. The function skips possible leading whitespace characters. Attribute name and value are returned in attributeName and attributeValue respectively. Attribute assignments can have the following forms:
aName="aValue" aName='aValue'
Surrounding single or double quotes of the attribute value are omitted. It is a syntax error if an attribute value is not quoted. White space characters before and after the = are ignored. XML entities in attributeValue are left as is. If no more attributes are present in the XML tag attributeName is set to "". In this case attributeValue contains the end of the XML tag (">" or "/>") and inFile.bufferChar contains the character after the closing '>'. If a syntax error occurs the function skips beyond the end of the XML tag (inFile.bufferChar contains the character after the closing '>'). To indicate the syntax error attributeName is set to "" and attributeValue is set to a symbol shortly before the error (this will never be ">" or "/>"). The attributes of an XML start-tag or empty-element tag can be processed with:
getNextXmlAttribute(inFile, attributeName, attributeValue); while attributeName <> "" do ... process the current attribute ... getNextXmlAttribute(inFile, attributeName, attributeValue); end while; if attributeValue = "/>" then ... this is an empty-element tag ... elsif attributeValue = ">" then ... this is a start-tag ... else ... there is a syntax error ... end if;
- Parameters:
- inFile - Input file
- attributeName - Destination for the attribute name.
- attributeValue - Destination for the attribute value:
getHtmlAttributeValue
const func string: getHtmlAttributeValue (inout file: inFile)
-
Reads a HTML tag attribute value from a file. Before reading the value it skips whitespace characters. A HTML tag attribute value can be quoted with " or ' or it is terminated with the character > or a whitespace character. When the function is called it is assumed that inFile.bufferChar contains a whitespace character or the first character of a value. When the function is left inFile.bufferChar contains the character after the XML/HTML attribute value or EOF.
- Parameters:
- inFile - Input file
- Returns:
- the attribute value, and "" if the end of the HTML tag or EOF is directly after the skipped whitespace characters.
getNextHtmlAttribute
const proc: getNextHtmlAttribute (inout file: inFile, inout string: attributeName, inout string: attributeValue)
-
Reads name and value of an attribute inside a HTML tag from a file. The function skips possible leading whitespace characters. Attribute name and value are returned in attributeName and attributeValue respectively. Attribute assignments can have the following forms:
aName="aValue" aName='aValue' aName=aValue aName
Possible surrounding single or double quotes of the attribute value are omitted. White space characters before and after the = are ignored. HTML entities in attributeValue are left as is. If no more attributes are present in the HTML tag attributeName is set to "". In this case attributeValue contains the end of the HTML tag (">" or "/>") and inFile.bufferChar contains the character after the closing '>'. The attributes of a HTML start-tag or empty-element tag can be processed with:
getNextHtmlAttribute(inFile, attributeName, attributeValue); while attributeName <> "" do ... process the current attribute ... getNextHtmlAttribute(inFile, attributeName, attributeValue); end while; if attributeValue = "/>" then ... this is an empty-element tag ... else # attributeValue = ">" ... this is a start-tag ... end if;
- Parameters:
- inFile - Input file
- attributeName - Destination for the attribute name.
- attributeValue - Destination for the attribute value:
getSimpleSymbol
const func string: getSimpleSymbol (inout file: inFile)
-
Reads a simple symbol from a file. Before reading the simple symbol it skips whitespace characters. A simple symbol can be an integer literal, a name, a special symbol (sequence of special characters) or a parenthesis. Note that string, char and float literals are not recognized as simple symbol.
- Returns:
- the simple symbol, and "" if EOF was reached.
|
|