convert Prolog text into tokens
More...
convert Prolog text into tokens
The tokens are supposed to be used by the parser, but can also be exported as a list
Description:
This module produces a list of tokens for use by the parser The calling program should supply a routine int nextch(charpos) int *charpos
; which, when called should produce the next char or -1 if none availlable The scanner will stop producing tokens when it either finds an end of file (-1) or a token consisting of just '' followed by a blank or control char Scanner errors will be signalled by the scanner exiting with a non- zero ErrorMsg and ErrorPos Note that, even in this case, the scanner will try to find the end of the term A function char *AllocScannerMemory(nbytes) should be supplied for allocating (temporary) space for strings and for the table of prolog variables occurring in the term
◆ scanner_extra_alloc
struct scanner_extra_alloc |
◆ add_ch_to_buff
#define add_ch_to_buff |
( |
|
ch | ) |
|
Value: {\
if (ch == 10 && (trueGlobalPrologFlag(ISO_FLAG) || \
falseLocalPrologFlag(MULTILINE_QUOTED_TEXT_FLAG)))\
{ \
\
}\
if (t) { t->Tok = Ord(kind = eot_tok); \
} \
charp += put_utf8(charp, ch); }
Definition at line 884 of file scanner.c.
◆ CHECK_SPACE
Value: if (ASP - HR < 1024) { \
LOCAL_ErrorMessage = "Stack Overflow"; \
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; \
LOCAL_Error_Size = 0L; \
if (p) { \
p->Tok = Ord(kind = eot_tok); \
p->TokInfo = TermOutOfStackError; \
} \
\
return l; \
}
Definition at line 731 of file scanner.c.
◆ CodeSpaceError
#define CodeSpaceError |
( |
|
t, |
|
|
|
p, |
|
|
|
l |
|
) |
| CodeSpaceError__(t, p, l PASS_REGS) |
◆ my_islower
#define my_islower |
( |
|
C | ) |
(C >= 'a' && C <= 'z') |
◆ my_isupper
#define my_isupper |
( |
|
C | ) |
(C >= 'A' && C <= 'Z') |
◆ my_isxdigit
#define my_isxdigit |
( |
|
C, |
|
|
|
SU, |
|
|
|
SL |
|
) |
| (chtype(C) == NU || (C >= 'A' && C <= (SU)) || (C >= 'a' && C <= (SL))) |
◆ number_overflow
#define number_overflow |
( |
| ) |
|
Value: { \
imgsz = Yap_Min(imgsz * 2, imgsz); \
char *nbuf; \
nbuf = Realloc(buf, imgsz); \
left = imgsz - max_size; \
max_size = imgsz; \
buf = nbuf; \
}
Definition at line 435 of file scanner.c.
◆ safe_add_ch_to_buff
#define safe_add_ch_to_buff |
( |
|
ch | ) |
charp += put_utf8(charp, ch); |
◆ TrailSpaceError
#define TrailSpaceError |
( |
|
t, |
|
|
|
l |
|
) |
| TrailSpaceError__(t, l PASS_REGS) |
◆ Yap_clean_tokenizer()
void Yap_clean_tokenizer |
( |
void |
| ) |
|
terminate scanning: just closes the comment store
Definition at line 1577 of file scanner.c.
◆ Yap_scan_num()
This routine is used when we need to parse a string into a number.
Definition at line 666 of file scanner.c.
◆ Yap_tokenizer()
TokEntry * Yap_tokenizer |
( |
void * |
st_, |
|
|
void * |
params_ |
|
) |
| |
◆ Yap_tokRep()
Term Yap_tokRep |
( |
void * |
tokptre | ) |
|
convert a token to text
represent token *_tokptr_ in string s, maxlength is sz-1
Definition at line 747 of file scanner.c.
◆ Yap_tokText()
const char * Yap_tokText |
( |
void * |
tokptre | ) |
|
◆ Yap_chtype0
char_kind_t Yap_chtype0[NUMBER_OF_CHARS+1] |