eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'JavaScriptScanner':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: JavaScriptScanner


Inheritance:

   Object
   |
   +--Scanner
      |
      +--JavaScriptScanner
         |
         +--JavaScriptParser

Package:
stx:libjavascript
Category:
Languages-JavaScript-Compiling & Parsing
Version:
rev: 1.56 date: 2018/04/24 19:33:25
user: cg
file: JavaScriptScanner.st directory: libjavascript
module: stx stc-classLibrary: libjavascript

Class protocol:

initialization
o  setupActions
initialize the scanners actionTables - these are used to dispatch
into scanner methods as characters are read
usage example(s):
     JavaScriptScanner setupActions


Instance protocol:

accessing
o  tokenType

initialization
o  initialize
initialize the scanner

private
o  checkForKeyword: string
check if string is a keyword (as opposed to an identifier).

o  handleCategoryDirective: categoryString
called when encountering a /** category: xxxx **/ comment;
categoryString will be xxxx.
Can be redefined in subclasses

o  handleCommentDirectivesIn: commentText
called for the text after the initial "/*"

o  isCommentCharacter: ch
return true, if ch is the comment-start character

reading next token
o  hex2CharacterEscape

o  hex4CharacterEscape

o  nextCharacter

o  nextMulti: list after: firstChar
a char has been read - peek ahead in list

o  nextNumber
nextChar == (Character cr) ifTrue:[

o  nextString

o  nextStringOrCharacter: asCharacter

o  nextToken
Verbose := true

o  skipComment
* has already been read"

o  skipEOLComment
/ has already been read"


Examples:


|s in| in := ' function scalefactor(value) { scalevector[0]=value; scalevector[1]=1.; scalevector[2]=1.; } '. s := JavaScriptScanner for:in readStream. s nextToken |s in| in := ' function scalefactor(value) { scalevector[0]=value; scalevector[1]=1.; scalevector[2]=1.; } '. s := JavaScriptScanner new. s scanTokens:(in readStream).

ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sat, 21 Jul 2018 19:22:04 GMT