Added OPTf_DECIMAL_ONLY

This commit is contained in:
Void NV 2020-03-20 00:08:53 -05:00
parent d6e3956704
commit ce63335991
6 changed files with 73 additions and 46 deletions

Binary file not shown.

View File

@ -438,16 +438,16 @@ I64 LexInStr(CCompCtrl *cc,U8 *buf,I64 size,Bool *done)
I64 Lex(CCompCtrl *cc)
{//Fetch next token.
I64 i,j,k,l,ch;
I64 i, j, k, l, ch;
CHash *tmph;
Bool str_done,in_str,neg_e;
U8 *fbuf,*buf2,*buf3,buf[STR_LEN];
cc->last_line_num=cc->lex_include_stack->line_num;
Bool str_done, in_str, neg_e;
U8 *fbuf, *buf2, *buf3, buf[STR_LEN];
cc->last_line_num = cc->lex_include_stack->line_num;
while (TRUE) {
lex_cont:
switch [ch=LexCharGet(cc)] {
case 0:
return cc->token=TK_EOF;
return cc->token = TK_EOF;
case TK_SUPERSCRIPT:
ch='>';
goto lex_ident;
@ -458,8 +458,8 @@ lex_cont:
ch='=';
goto lex_ident;
case '@':
if (cc->flags&CCF_KEEP_AT_SIGN) {
cc->token=ch;
if (cc->flags & CCF_KEEP_AT_SIGN) {
cc->token = ch;
goto lex_end;
}
case 'A'...'Z':
@ -515,33 +515,36 @@ lex_ident:
case '0'...'9':
i=ch-'0';
ch=ToUpper(LexCharGet(cc));
if (ch=='X') {
while (TRUE) {
ch=ToUpper(LexCharGet(cc));
if (Bt(char_bmp_hex_numeric,ch)) {
if (ch<='9')
i=i<<4+ch-'0';
else
i=i<<4+ch-'A'+10;
} else {
cc->cur_i64=i;
cc->flags|=CCF_USE_LAST_U16;
cc->token=TK_I64;
goto lex_end;
if (!Bt(&cc->opts, OPTf_DECIMAL_ONLY))
{
if (ch=='X') {
while (TRUE) {
ch=ToUpper(LexCharGet(cc));
if (Bt(char_bmp_hex_numeric,ch)) {
if (ch<='9')
i=i<<4+ch-'0';
else
i=i<<4+ch-'A'+10;
} else {
cc->cur_i64=i;
cc->flags|=CCF_USE_LAST_U16;
cc->token=TK_I64;
goto lex_end;
}
}
}
} else if (ch=='B') {
while (TRUE) {
ch=LexCharGet(cc);
if (ch=='0')
i=i<<1;
else if (ch=='1')
i=i<<1+1;
else {
cc->cur_i64=i;
cc->flags|=CCF_USE_LAST_U16;
cc->token=TK_I64;
goto lex_end;
} else if (ch=='B') {
while (TRUE) {
ch=LexCharGet(cc);
if (ch=='0')
i=i<<1;
else if (ch=='1')
i=i<<1+1;
else {
cc->cur_i64=i;
cc->flags|=CCF_USE_LAST_U16;
cc->token=TK_I64;
goto lex_end;
}
}
}
}

View File

@ -1,6 +1,6 @@
//Ed("/Doc/ChangeLog.DD");
In("CC\n\n1\n\n5\n\n\n");
In("CC\n\n1\n\n6\n\n\n");
BootHDIns;
"\n\nSuccessful? ";
if(YorN)

13
src/Home/MakeHome.CC Normal file
View File

@ -0,0 +1,13 @@
Cd(__DIR__);;
//If these are not present in /Home, it uses the version in the root dir. You
//can make your own, modified, version of these files in your /Home directory.
#include "~/HomeLocalize"
#include "/Zenith/Boot/MakeBoot"
#include "/Zenith/Utils/MakeUtils"
#include "~/HomeWrappers"
MapFileLoad("::/Kernel/Kernel");
MapFileLoad("::/Compiler/Compiler");
#include "~/HomeKeyPlugIns"
#include "~/HomeSys"
Cd("..");;

10
src/Home/Registry.CC Normal file
View File

@ -0,0 +1,10 @@
$TR,"Zenith"$
$ID,2$$TR,"SysMessageFlags"$
$ID,2$sys_message_flags[0]=0;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=1.000;
$ID,-2$$ID,-2$$TR,"Once"$
$ID,2$$TR,"Zenith"$
$ID,2$$ID,-2$$TR,"User"$
$ID,2$$ID,-2$$ID,-2$$TR,"AutoComplete"$
$ID,2$ac.col=98;ac.row=23;$ID,-2$

View File

@ -1667,19 +1667,20 @@ public class CAutoCompleteDictGlobals
//You might need to do #exe {Option();}
//Note: The #exe stmt is lexed-ahead,
//so it takes effect earlier than you might expect.
#define OPTf_ECHO 0x00
#define OPTf_TRACE 0x01
#define OPTf_WARN_UNUSED_VAR 0x10 //Applied to funs, not statements
#define OPTf_WARN_PAREN 0x11 //Warn unnecessary parens
#define OPTf_WARN_DUP_TYPES 0x12 //Warn dup local var type statements
#define OPTf_WARN_HEADER_MISMATCH 0x13
#define OPTf_EXTERNS_TO_IMPORTS 0x20
#define OPTf_KEEP_PRIVATE 0x21
#define OPTf_NO_REG_VAR 0x22 //Applied to funs, not statements
#define OPTf_GLOBALS_ON_DATA_HEAP 0x23
#define OPTf_ECHO 0
#define OPTf_TRACE 1
#define OPTf_WARN_UNUSED_VAR 2 //Applied to funs, not statements
#define OPTf_WARN_PAREN 3 //Warn unnecessary parens
#define OPTf_WARN_DUP_TYPES 4 //Warn dup local var type statements
#define OPTf_WARN_HEADER_MISMATCH 5
#define OPTf_EXTERNS_TO_IMPORTS 6
#define OPTf_KEEP_PRIVATE 7
#define OPTf_NO_REG_VAR 8 //Applied to funs, not statements
#define OPTf_GLOBALS_ON_DATA_HEAP 9
//Disable 10-byte float consts for ã,log2_10,log10_2,loge_2
#define OPTf_NO_BUILTIN_CONST 0x24 //Applied to funs, not statements
#define OPTf_USE_IMM64 0x25 //Not completely implemented
#define OPTf_NO_BUILTIN_CONST 10 //Applied to funs, not statements
#define OPTf_USE_IMM64 11 //Not completely implemented
#define OPTf_DECIMAL_ONLY 12 //Only allow decimal numbers (no 0x or 0b prefixed numbers)
#define OPTF_ECHO (1<<OPTf_ECHO)