Seed7 - The extensible programming language
Seed7 FAQ Manual Screenshots Examples Libraries Algorithms Download Links
Libraries AES ARC4 Array ASN.1 Bigfile Bigint Bigrat Bin32 Bin64 Bitdata Bitmapfont Bitset Bitsetof Boolean Browser Bstring Bytedata Cards Category CC config Cgi Cgi dialog Char Charsets Cipher Clib_file Color CLI Commands Complex Console Crc32 Deflate DES Dialog Dir Draw Duration Echo Editline Enable_input Enable_io Enable_output Encoding Environment External_file File File system Float Font Forloop Ftp Getf Gethttp Gethttps Graph Graph_file Gzip Hash Hashsetof Hmac Html_ent Httpserv Idxarray Image Inflate Inflate file Inifile Integer Keybd Line Listener LZW Make Math Msgdigest Null_file Osfiles Picture utility Pixmap_file Pixmapfont PKCS #1 Poll Process Progs Propertyfile Rational Reference Ref_list Scanfile Scanstri Set Shell Smtp Sockbase Socket SQL base Stdio Strifile String Stritext Subrange Tar Text Time TLS/SSL Triple DES Unicode Utf16 Utf8 Vectorfont 3D Vector Window Wrinum X.509 Xmldom Xml_ent Zip
Libraries
Scanstri Source Code
 previous   up   next 

Function Summary
void
skipComment (inout string: stri)
Skips a possibly nested comment from a string.
string
getComment (inout string: stri)
Reads a possibly nested comment from a string.
void
skipLineComment (inout string: stri)
Skips a line comment from a string.
string
getLineComment (inout string: stri)
Reads a line comment from a string.
string
getDigits (inout string: stri)
Reads a sequence of digits from a string.
string
getInteger (inout string: stri)
Reads a decimal integer with optional sign from a string.
string
getNumber (inout string: stri)
Reads a numeric literal from a string.
string
getNonDigits (inout string: stri)
Reads a sequence of non digits from a string.
string
getQuotedText (inout string: stri)
Reads a text quoted with " or ' from a string.
string
getCommandLineWord (inout string: stri)
Read a space terminated command line word, from a string.
void
getEscapeSequence (in string: stri, inout integer: pos, inout string: symbol)
Reads an escape sequence from stri and appends it to symbol.
string
getCharLiteral (inout string: stri)
Reads a character literal from a string.
string
getStringLiteral (inout string: stri)
Reads a string literal from a string.
string
getCStringLiteralText (inout string: stri)
Reads the text of a string literal from a string.
string
getName (inout string: stri)
Reads an alphanumeric name from a string.
void
skipSpace (inout string: stri)
Skips space characters from a string.
void
skipSpaceOrTab (inout string: stri)
Skips space and tab characters from a string.
void
skipWhiteSpace (inout string: stri)
Skips whitespace characters from a string.
string
getWhiteSpace (inout string: stri)
Reads whitespace characters from a string.
string
getWord (inout string: stri)
Reads a white space delimited word from a string.
void
skipLine (inout string: stri)
Skips a line from a string.
string
getLine (inout string: stri)
Reads a line from a string.
string
getSymbolOrComment (inout string: stri)
Reads a symbol or a comment from a string.
string
getSymbol (inout string: stri)
Reads a symbol from a string.
void
skipXmlComment (inout string: stri)
Skips a XML comment from a string.
string
getXmlTagOrContent (inout string: stri)
Reads a XML/HTML tag or the XML/HTML content text from a string.
string
getXmlTagHeadOrContent (inout string: stri)
Reads a XML/HTML tag head or a XML/HTML content from a string.
string
getSymbolInXmlTag (inout string: stri)
Reads a symbol which can appear inside a XML/HTML tag from string.
void
skipXmlTag (inout string: stri)
Skips beyond a XML Tag in a string.
void
skipXmlTag (inout string: stri, in var string: symbol)
Skips beyond a XML Tag in a string.
void
getNextXmlAttribute (inout string: stri, inout string: attributeName, inout string: attributeValue)
Reads name and value of an attribute inside a XML tag from string.
string
getHtmlAttributeValue (inout string: stri)
Reads a HTML tag attribute value from a string.
void
getNextHtmlAttribute (inout string: stri, inout string: attributeName, inout string: attributeValue)
Reads name and value of an attribute inside a HTML tag from string.
string
getHttpSymbol (inout string: stri)
Reads a symbol which appears in a HTTP header from a string.

Function Detail

skipComment

const proc: skipComment (inout string: stri)

Skips a possibly nested comment from a string. The comment starts with (* and ends with *) . When the function is called it is assumed that stri[1] contains the '*' of the comment start. When the function is left stri is empty or stri[1] contains the character after the ')'.


getComment

const func string: getComment (inout string: stri)

Reads a possibly nested comment from a string. The comment starts with (* and ends with *) . When the function is called it is assumed that stri[1] contains the '*' of the comment start. When the function is left stri is empty or stri[1] contains the character after the ')'.

Returns:
the content of the comment, including the introducing (* and the ending *) .

skipLineComment

const proc: skipLineComment (inout string: stri)

Skips a line comment from a string. 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 stri is empty or stri[1] contains the introducing character (e.g. '#'). When the function is left stri is empty or stri[1] contains the line end character ('\n').


getLineComment

const func string: getLineComment (inout string: stri)

Reads a line comment from a string. 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 stri is empty or stri[1] contains the introducing character (e.g. '#'). When the function is left stri is empty or stri[1] contains the line end character ('\n').

Returns:
the content of the comment, including the start marker (e.g. '#') but without line end character ('\n').

getDigits

const func string: getDigits (inout string: stri)

Reads a sequence of digits from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the digits.

Returns:
the digit sequence or "" when no digit was found.

getInteger

const func string: getInteger (inout string: stri)

Reads a decimal integer with optional sign from a string. 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 stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the integer.

Returns:
the decimal integer string or "" when no integer was found.

getNumber

const func string: getNumber (inout string: stri)

Reads a numeric literal from a string. When the function is called it is assumed that stri is empty or stri[1] contains the introducing digit. When the function is left stri is empty or stri[1] contains the character after the literal.

Returns:
The function returns the numeric literal.

getNonDigits

const func string: getNonDigits (inout string: stri)

Reads a sequence of non digits from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains a digit.

Returns:
the non digit sequence or "" when a digit was found.

getQuotedText

const func string: getQuotedText (inout string: stri)

Reads a text quoted with " or ' from a string. The introducing and the closing character ( " or ' ) of the quoted text must be identical. When the function is called it is assumed that stri[1] contains the introducing " or ' . When the function is left stri is empty or stri[1] contains the character after the closing character.

Returns:
the string literal without introducing or closing characters ( " or ' ).

getCommandLineWord

const func string: getCommandLineWord (inout string: stri)

Read a space terminated command line word, from a string. Before reading the word it skips whitespace characters. A command line word can consist of unquoted and quoted parts. A quoted part is introduced with double quotes (") and ends with unescaped double quotes. A \ (backslash) is used to escape characters that would terminate the word respectively the quoted part. The backslash is ignored and the character after it is added to the word. To represent a backslash it must be doubled. When the function is left stri is empty or stri[1] contains the character after the terminating space. Examples:

stri := "a b c";        # getCommandLineWord(stri) returns "a"
stri := "a\\ b c";      # getCommandLineWord(stri) returns "a b"
stri := " a b c";       # getCommandLineWord(stri) returns "a"
stri := "\\ a b c";     # getCommandLineWord(stri) returns " a"
stri := "a\\\"b c";     # getCommandLineWord(stri) returns "a\"b"
stri := "a\" b\" c";    # getCommandLineWord(stri) returns "a b"
stri := "\"a b\" c";    # getCommandLineWord(stri) returns "a b"
stri := " \"a\" b c";   # getCommandLineWord(stri) returns "a"
stri := "\" a\" b c";   # getCommandLineWord(stri) returns " a"
stri := " \" a\" b c";  # getCommandLineWord(stri) returns " a"
stri := "\"a\\\"b\" c"; # getCommandLineWord(stri) returns "a\"b"
stri := "a\\\\b c";     # getCommandLineWord(stri) returns "a\\b"
Returns:
the space terminated word (without terminating space).

getEscapeSequence

const proc: getEscapeSequence (in string: stri, inout integer: pos, inout string: symbol)

Reads an escape sequence from stri and appends it to symbol. The function accepts escape sequences from character and string literals. When the function is called it is assumed that stri[1] contains the introducing \ . When the function is left stri[1] contains the character after the escape sequence. The complete escape sequence including the introducing \ is appended to symbol.


getCharLiteral

const func string: getCharLiteral (inout string: stri)

Reads a character literal from a string. When the function is called it is assumed that stri[1] contains the introducing ' . When the function is left stri is empty or stri[1] contains the character after the closing ' .

Returns:
the character literal including the introducing ' and the closing ' .

getStringLiteral

const func string: getStringLiteral (inout string: stri)

Reads a string literal from a string. When the function is called it is assumed that stri[1] contains the introducing " . When the function is left stri is empty or stri[1] contains the character after the closing " .

Returns:
the string literal including the introducing " and the closing " .

getCStringLiteralText

const func string: getCStringLiteralText (inout string: stri)

Reads the text of a string literal from a string. When the function is called it is assumed that stri[1] contains the introducing " . When the function is left stri is empty or stri[1] contains the character after the closing " .

Returns:
the text of the string literal without introducing or closing " .

getName

const func string: getName (inout string: stri)

Reads an alphanumeric name from a string. A name consists of a letter or underscore followed by letters, digits or underscores. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the name.

Returns:
the name or "" when no letter or underscore was found.

skipSpace

const proc: skipSpace (inout string: stri)

Skips space characters from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the space characters.


skipSpaceOrTab

const proc: skipSpaceOrTab (inout string: stri)

Skips space and tab characters from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the sequence of space and tab characters.


skipWhiteSpace

const proc: skipWhiteSpace (inout string: stri)

Skips whitespace characters from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the whitespace characters.


getWhiteSpace

const func string: getWhiteSpace (inout string: stri)

Reads whitespace characters from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the whitespace characters.

Returns:
the string of whitespace characters or "" when no whitespace character was found.

getWord

const func string: getWord (inout string: stri)

Reads a white space delimited word from a string. 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 stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains the character after the word.

Returns:
the word or "" when no word was found.

skipLine

const proc: skipLine (inout string: stri)

Skips a line from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains '\n'. When stri[1] already contains '\n' nothing is done.


getLine

const func string: getLine (inout string: stri)

Reads a line from a string. When the function is called it is assumed that stri is empty or stri[1] contains the first character to be handled. When the function is left stri is empty or stri[1] contains '\n'. When stri[1] already contains '\n' nothing is done and the function returns "" .

Returns:
the line read or "" when stri is empty or stri[1] contains '\n'.

getSymbolOrComment

const func string: getSymbolOrComment (inout string: stri)

Reads a symbol or a comment from a string. 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 stri is empty or stri[1] contains a whitespace character or the first character of a symbol or comment. When the function is left stri is empty or stri[1] contains the character after the symbol or comment.

Returns:
the symbol, comment or "" when EOF was reached.

getSymbol

const func string: getSymbol (inout string: stri)

Reads a symbol from a string. 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 stri is empty or stri[1] contains a whitespace character or the first character of a symbol or comment. When the function is left stri is empty or stri[1] contains the character after the symbol.

Returns:
the symbol or "" when EOF was reached.

skipXmlComment

const proc: skipXmlComment (inout string: stri)

Skips a XML comment from a string. The XML comment starts with <!-- and ends with --> . When the function is called it is assumed that stri[1] contains the last '-' of the introducing <!-- . When the function is left stri is empty or stri[1] contains the character after --> .


getXmlTagOrContent

const func string: getXmlTagOrContent (inout string: stri)

Reads a XML/HTML tag or the XML/HTML content text from a string. A 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 stri[1] contains the introducing < of a XML/HTML tag or the first charater of the content text. When the function is left the character after the XML/HTML tag or the content text is in stri[1].

Returns:
the XML/HTML tag, XML/HTML content text or "" when EOF was reached.

getXmlTagHeadOrContent

const func string: getXmlTagHeadOrContent (inout string: stri)

Reads a XML/HTML tag head or a XML/HTML content from a string. Before reading a tag head or content it skips whitespace characters and XML comments. A 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 with EOF. When the function is called it is assumed that stri is empty or stri[1] contains either a whitespace character, the introducing < of a XML/HTML tag or the first charater of the content text. When the function is left stri is empty or stri[1] contains the character after the XML/HTML tag head or the content text. When a tag head starts with <-- it is interpreted as XML comment. A XML comment is ignored and getXmlTagHeadOrContent is called recursive.

Returns:
the XML/HTML tag head, XML/HTML content text or "" when EOF was reached.

getSymbolInXmlTag

const func string: getSymbolInXmlTag (inout string: stri)

Reads a symbol which can appear inside a XML/HTML tag from string. Before reading the symbol it skips whitespace characters. A symbol inside a XML/HTML tag can be a name, a string literal (quoted with " or ' ), the equals sign (=), the end tag sign (>), the end of empty element tag sign (/) or a special symbol (sequence of characters terminated with the character > or a whitespace character). Special symbols can only appear in HTML tags. When the function is called it is assumed that stri is empty or stri[1] contains a whitespace character or the first character of a symbol. When the function is left stri is empty or stri[1] contains the character after the symbol.

Returns:
the symbol or "" when EOF was reached.

skipXmlTag

const proc: skipXmlTag (inout string: stri)

Skips beyond a XML Tag in a string. When the function is left stri is empty or stri[1] contains the character after '>'.


skipXmlTag

const proc: skipXmlTag (inout string: stri, in var string: symbol)

Skips beyond a XML Tag in a string. The parameter symbol is used to provide the current symbol which possibly can be ">" or "". When the function is left stri is empty or stri[1] contains the character after '>'.


getNextXmlAttribute

const proc: getNextXmlAttribute (inout string: stri, inout string: attributeName, inout string: attributeValue)

Reads name and value of an attribute inside a XML tag from string. Attribute name and value are returned in attributeName and attributeValue respectively. Surrounding single or double quotes of the attribute value are omitted. It is a syntax error when an attribute value is not quoted. XML entities in attributeValue are left as is. When 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 "/>"). When a syntax error occurs the function skips beyond the end of the XML tag. 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 "/>").


getHtmlAttributeValue

const func string: getHtmlAttributeValue (inout string: stri)

Reads a HTML tag attribute value from a string. 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 stri is empty or stri[1] contains a whitespace character or the first character of a value. When the function is left stri is empty or stri[1] contains the character after the value.

Returns:
the symbol or "" when EOF was reached.

getNextHtmlAttribute

const proc: getNextHtmlAttribute (inout string: stri, inout string: attributeName, inout string: attributeValue)

Reads name and value of an attribute inside a HTML tag from string. The variable attributeName is set to "" when no more attributes are present in the HTML tag. When the HTML tag ends with / the function assigns "/" to attributeValue when attributeName is set to "". When the HTML tag does not end with / attributeValue and attributeName are set to "" when no more attributes are present.


getHttpSymbol

const func string: getHttpSymbol (inout string: stri)

Reads a symbol which appears in a HTTP header from a string. Before reading the symbol it skips whitespace characters. A symbol from a HTTP header can be a token a string literal or a separator. When the function is called it is assumed that stri is empty or stri[1] contains a whitespace character or the first character of a symbol. When the function is left stri is empty or stri[1] contains the character after the symbol.

Returns:
the symbol or "" when EOF was reached.


 previous   up   next