Classes | Defines | Typedefs | Enumerations | Functions

jsscan.h File Reference

#include <stddef.h>
#include <stdio.h>
#include "jsversion.h"
#include "jsopcode.h"
#include "jsprvtd.h"
#include "jspubtd.h"
#include "jsvector.h"
#include "jskeyword.tbl"
Include dependency graph for jsscan.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  JSTokenPtr
struct  JSTokenPos
struct  JSToken
struct  JSTokenBuf
struct  JSTokenStream

Defines

#define JS_KEYWORD(keyword, type, op, version)   extern const char js_##keyword##_str[];
#define IS_PRIMARY_TOKEN(tt)   ((uintN)((tt) - TOK_NAME) <= (uintN)(TOK_PRIMARY - TOK_NAME))
#define TOKEN_TYPE_IS_XML(tt)   ((tt) == TOK_AT || (tt) == TOK_DBLCOLON || (tt) == TOK_ANYNAME)
#define TREE_TYPE_IS_XML(tt)
#define TOKEN_TYPE_IS_DECL(tt)   ((tt) == TOK_VAR)
#define t_op   u.s.op
#define t_reflags   u.reflags
#define t_atom   u.s.atom
#define t_atom2   u.p.atom2
#define t_dval   u.dval
#define JS_LINE_LIMIT   256
#define NTOKENS   4
#define NTOKENS_MASK   (NTOKENS-1)
#define CURRENT_TOKEN(ts)   ((ts)->tokens[(ts)->cursor])
#define ON_CURRENT_LINE(ts, pos)   ((ts)->lineno == (pos).end.lineno)
#define TSF_ERROR   0x01
#define TSF_EOF   0x02
#define TSF_NEWLINES   0x04
#define TSF_OPERAND   0x08
#define TSF_NLFLAG   0x20
#define TSF_CRFLAG   0x40
#define TSF_DIRTYLINE   0x80
#define TSF_OWNFILENAME   0x100
#define TSF_XMLTAGMODE   0x200
#define TSF_XMLTEXTMODE   0x400
#define TSF_XMLONLYMODE   0x800
#define TSF_UNEXPECTED_EOF   0x1000
#define TSF_IN_HTML_COMMENT   0x2000
#define TSF_KEYWORD_IS_NAME   0x4000
#define TSF_STRICT_MODE_CODE   0x8000
#define LINE_SEPARATOR   0x2028
#define PARA_SEPARATOR   0x2029
#define JSREPORT_UC   0x100

Typedefs

typedef enum JSTokenType JSTokenType
typedef struct JSTokenBuf JSTokenBuf
typedef void(* JSMapKeywordFun )(const char *)

Enumerations

enum  JSTokenType {
  TOK_ERROR = -1, TOK_EOF = 0, TOK_EOL = 1, TOK_SEMI = 2,
  TOK_COMMA = 3, TOK_ASSIGN = 4, TOK_HOOK = 5, TOK_COLON = 6,
  TOK_OR = 7, TOK_AND = 8, TOK_BITOR = 9, TOK_BITXOR = 10,
  TOK_BITAND = 11, TOK_EQOP = 12, TOK_RELOP = 13, TOK_SHOP = 14,
  TOK_PLUS = 15, TOK_MINUS = 16, TOK_STAR = 17, TOK_DIVOP = 18,
  TOK_UNARYOP = 19, TOK_INC = 20, TOK_DEC = 21, TOK_DOT = 22,
  TOK_LB = 23, TOK_RB = 24, TOK_LC = 25, TOK_RC = 26,
  TOK_LP = 27, TOK_RP = 28, TOK_NAME = 29, TOK_NUMBER = 30,
  TOK_STRING = 31, TOK_REGEXP = 32, TOK_PRIMARY = 33, TOK_FUNCTION = 34,
  TOK_IF = 35, TOK_ELSE = 36, TOK_SWITCH = 37, TOK_CASE = 38,
  TOK_DEFAULT = 39, TOK_WHILE = 40, TOK_DO = 41, TOK_FOR = 42,
  TOK_BREAK = 43, TOK_CONTINUE = 44, TOK_IN = 45, TOK_VAR = 46,
  TOK_WITH = 47, TOK_RETURN = 48, TOK_NEW = 49, TOK_DELETE = 50,
  TOK_DEFSHARP = 51, TOK_USESHARP = 52, TOK_TRY = 53, TOK_CATCH = 54,
  TOK_FINALLY = 55, TOK_THROW = 56, TOK_INSTANCEOF = 57, TOK_DEBUGGER = 58,
  TOK_XMLSTAGO = 59, TOK_XMLETAGO = 60, TOK_XMLPTAGC = 61, TOK_XMLTAGC = 62,
  TOK_XMLNAME = 63, TOK_XMLATTR = 64, TOK_XMLSPACE = 65, TOK_XMLTEXT = 66,
  TOK_XMLCOMMENT = 67, TOK_XMLCDATA = 68, TOK_XMLPI = 69, TOK_AT = 70,
  TOK_DBLCOLON = 71, TOK_ANYNAME = 72, TOK_DBLDOT = 73, TOK_FILTER = 74,
  TOK_XMLELEM = 75, TOK_XMLLIST = 76, TOK_YIELD = 77, TOK_ARRAYCOMP = 78,
  TOK_ARRAYPUSH = 79, TOK_LEXICALSCOPE = 80, TOK_LET = 81, TOK_SEQ = 82,
  TOK_FORHEAD = 83, TOK_ARGSBODY = 84, TOK_UPVARS = 85, TOK_RESERVED,
  TOK_LIMIT
}

Functions

void js_CloseTokenStream (JSContext *cx, JSTokenStream *ts)
int js_fgets (char *buf, int size, FILE *file)
JSTokenType js_CheckKeyword (const jschar *chars, size_t length)
void js_MapKeywords (JSMapKeywordFun mapfun)
JSBool js_IsIdentifier (JSString *str)
bool js_ReportCompileErrorNumber (JSContext *cx, JSTokenStream *ts, JSParseNode *pn, uintN flags, uintN errorNumber,...)
bool js_ReportStrictModeError (JSContext *cx, JSTokenStream *ts, JSTreeContext *tc, JSParseNode *pn, uintN errorNumber,...)
JSTokenType js_PeekToken (JSContext *cx, JSTokenStream *ts)
JSTokenType js_PeekTokenSameLine (JSContext *cx, JSTokenStream *ts)
JSTokenType js_GetToken (JSContext *cx, JSTokenStream *ts)
void js_UngetToken (JSTokenStream *ts)
JSBool js_MatchToken (JSContext *cx, JSTokenStream *ts, JSTokenType tt)

Define Documentation

#define CURRENT_TOKEN (   ts  )     ((ts)->tokens[(ts)->cursor])
#define IS_PRIMARY_TOKEN (   tt  )     ((uintN)((tt) - TOK_NAME) <= (uintN)(TOK_PRIMARY - TOK_NAME))
#define JS_KEYWORD (   keyword,
  type,
  op,
  version 
)    extern const char js_##keyword##_str[];
#define JS_LINE_LIMIT   256
#define JSREPORT_UC   0x100
#define LINE_SEPARATOR   0x2028
#define NTOKENS   4
#define NTOKENS_MASK   (NTOKENS-1)
#define ON_CURRENT_LINE (   ts,
  pos 
)    ((ts)->lineno == (pos).end.lineno)
#define PARA_SEPARATOR   0x2029
#define t_atom   u.s.atom
#define t_atom2   u.p.atom2
#define t_dval   u.dval
#define t_op   u.s.op
#define t_reflags   u.reflags
#define TOKEN_TYPE_IS_DECL (   tt  )     ((tt) == TOK_VAR)
#define TOKEN_TYPE_IS_XML (   tt  )     ((tt) == TOK_AT || (tt) == TOK_DBLCOLON || (tt) == TOK_ANYNAME)
#define TREE_TYPE_IS_XML (   tt  ) 
Value:
((tt) == TOK_XMLCOMMENT || (tt) == TOK_XMLCDATA || (tt) == TOK_XMLPI ||   \
     (tt) == TOK_XMLELEM || (tt) == TOK_XMLLIST)
#define TSF_CRFLAG   0x40
#define TSF_DIRTYLINE   0x80
#define TSF_EOF   0x02
#define TSF_ERROR   0x01
#define TSF_IN_HTML_COMMENT   0x2000
#define TSF_KEYWORD_IS_NAME   0x4000
#define TSF_NEWLINES   0x04
#define TSF_NLFLAG   0x20
#define TSF_OPERAND   0x08
#define TSF_OWNFILENAME   0x100
#define TSF_STRICT_MODE_CODE   0x8000
#define TSF_UNEXPECTED_EOF   0x1000
#define TSF_XMLONLYMODE   0x800
#define TSF_XMLTAGMODE   0x200
#define TSF_XMLTEXTMODE   0x400

Typedef Documentation

typedef void(* JSMapKeywordFun)(const char *)
typedef struct JSTokenBuf JSTokenBuf
typedef enum JSTokenType JSTokenType

Enumeration Type Documentation

Enumerator:
TOK_ERROR 
TOK_EOF 
TOK_EOL 
TOK_SEMI 
TOK_COMMA 
TOK_ASSIGN 
TOK_HOOK 
TOK_COLON 
TOK_OR 
TOK_AND 
TOK_BITOR 
TOK_BITXOR 
TOK_BITAND 
TOK_EQOP 
TOK_RELOP 
TOK_SHOP 
TOK_PLUS 
TOK_MINUS 
TOK_STAR 
TOK_DIVOP 
TOK_UNARYOP 
TOK_INC 
TOK_DEC 
TOK_DOT 
TOK_LB 
TOK_RB 
TOK_LC 
TOK_RC 
TOK_LP 
TOK_RP 
TOK_NAME 
TOK_NUMBER 
TOK_STRING 
TOK_REGEXP 
TOK_PRIMARY 
TOK_FUNCTION 
TOK_IF 
TOK_ELSE 
TOK_SWITCH 
TOK_CASE 
TOK_DEFAULT 
TOK_WHILE 
TOK_DO 
TOK_FOR 
TOK_BREAK 
TOK_CONTINUE 
TOK_IN 
TOK_VAR 
TOK_WITH 
TOK_RETURN 
TOK_NEW 
TOK_DELETE 
TOK_DEFSHARP 
TOK_USESHARP 
TOK_TRY 
TOK_CATCH 
TOK_FINALLY 
TOK_THROW 
TOK_INSTANCEOF 
TOK_DEBUGGER 
TOK_XMLSTAGO 
TOK_XMLETAGO 
TOK_XMLPTAGC 
TOK_XMLTAGC 
TOK_XMLNAME 
TOK_XMLATTR 
TOK_XMLSPACE 
TOK_XMLTEXT 
TOK_XMLCOMMENT 
TOK_XMLCDATA 
TOK_XMLPI 
TOK_AT 
TOK_DBLCOLON 
TOK_ANYNAME 
TOK_DBLDOT 
TOK_FILTER 
TOK_XMLELEM 
TOK_XMLLIST 
TOK_YIELD 
TOK_ARRAYCOMP 
TOK_ARRAYPUSH 
TOK_LEXICALSCOPE 
TOK_LET 
TOK_SEQ 
TOK_FORHEAD 
TOK_ARGSBODY 
TOK_UPVARS 
TOK_RESERVED 
TOK_LIMIT 

Function Documentation

JSTokenType js_CheckKeyword ( const jschar chars,
size_t  length 
)
void js_CloseTokenStream ( JSContext cx,
JSTokenStream ts 
)
int js_fgets ( char *  buf,
int  size,
FILE *  file 
)
JSTokenType js_GetToken ( JSContext cx,
JSTokenStream ts 
)
JSBool js_IsIdentifier ( JSString str  ) 
void js_MapKeywords ( JSMapKeywordFun  mapfun  ) 
JSBool js_MatchToken ( JSContext cx,
JSTokenStream ts,
JSTokenType  tt 
)
JSTokenType js_PeekToken ( JSContext cx,
JSTokenStream ts 
)
JSTokenType js_PeekTokenSameLine ( JSContext cx,
JSTokenStream ts 
)
bool js_ReportCompileErrorNumber ( JSContext cx,
JSTokenStream ts,
JSParseNode pn,
uintN  flags,
uintN  errorNumber,
  ... 
)
bool js_ReportStrictModeError ( JSContext cx,
JSTokenStream ts,
JSTreeContext tc,
JSParseNode pn,
uintN  errorNumber,
  ... 
)
void js_UngetToken ( JSTokenStream ts  )