Skip to content

Commit

Permalink
version 6.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ab25cq committed Oct 9, 2018
1 parent 0ad8ed9 commit 3b4c72f
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 26 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

version 6.5.8

Improved String.indexOf, String.rindexOf algorism

Fixed bug of shell mode

Fixed bug of Command Class

version 6.5.7

JITの改良。
Expand Down
28 changes: 24 additions & 4 deletions Command.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ dynamic_class Command
}
}

def expandArg(arg:String):static SortableList<String> {
def expandArg(arg:String, quoted_string:bool=false):static SortableList<String> {
if(Directory.isGlobString(arg)) {
dir := dirname(arg);
if(dir.equals(".")) {
Expand All @@ -563,15 +563,31 @@ dynamic_class Command
pattern = arg;
}

return Directory.glob(dir, pattern, 0).map { it.subString(2,-1); }.select { !it.equals(".") && !it.equals("..") };
if(quoted_string) {
return slist { pattern };
}
else {
return Directory.glob(dir, pattern, 0).map { it.subString(2,-1); }.select { !it.equals(".") && !it.equals("..") };
}
}
elif(dir.equals("/")) {
pattern := arg.subString(1, -1);
return Directory.glob(dir, pattern, 0).select { !it.equals("/.") && !it.equals("/.."); }

if(quoted_string) {
return slist { pattern };
}
else {
return Directory.glob(dir, pattern, 0).select { !it.equals("/.") && !it.equals("/.."); }
}
}
else {
pattern := arg.subString(dir.length()+1, -1);
return Directory.glob(dir, pattern, 0).select { !it.equals(dir.add("/.")) && !it.equals(dir.add("/..")) };
if(quoted_string) {
return slist { pattern };
}
else {
return Directory.glob(dir, pattern, 0).select { !it.equals(dir.add("/.")) && !it.equals(dir.add("/..")) };
}
}
}
else {
Expand Down Expand Up @@ -789,11 +805,13 @@ dynamic_class Command

Clover.jobs.add(job);

setpgid(getpid(), getpid());
tcsetpgrp(0, getpid());

return Command("", rcode);
}
else {
setpgid(getpid(), getpid());
tcsetpgrp(0, getpid());

return Command("", WEXITSTATUS(status));
Expand Down Expand Up @@ -867,11 +885,13 @@ dynamic_class Command

Clover.jobs.add(job);

setpgid(getpid(), getpid());
tcsetpgrp(0, getpid());

return Command("", rcode);
}
else {
setpgid(getpid(), getpid());
tcsetpgrp(0, getpid());

return Command("", WEXITSTATUS(status));
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# clover2 computer language

version 6.5.7
version 6.5.8

サポートしている機能

Expand Down
39 changes: 26 additions & 13 deletions String.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -882,16 +882,22 @@ class String
return result;
}

def rindexOf(str:String, count:int=1):int {
result := -1;
count2 := 0;
len := str.length();
def indexOf(str:String, count:int): int throws Exception {
result:int = -1;
count2:int = 0;
len:int = str.length();

for(i:=self.len; i>=len; i--) {
if(self.subString(i-len, i).equals(str)) {
for(i:=0; i<self.len; i++) {
for(j:=0; j<str.len; j++) {
if(self.buffer[i+j] != str.buffer[j])
{
break;
}
}
if(j == str.len) {
count2++;
if(count2 == count) {
result = i-1;
result = i;
break;
}
}
Expand All @@ -900,13 +906,20 @@ class String
return result;
}

def indexOf(str:String, count:int): int throws Exception {
result:int = -1;
count2:int = 0;
len:int = str.length();

for(i:=0; i<self.len; i++) {
if(self.subString(i, i+len).equals(str)) {
def rindexOf(str:String, count:int=1):int {
result := -1;
count2 := 0;
len := str.length();

for(i:=self.len-len; i>=0; i--) {
for(j:=0; j<len; j++) {
if(self.buffer[i+j] != str.buffer[j])
{
break;
}
}
if(j == len) {
count2++;
if(count2 == count) {
result = i;
Expand Down
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

clover2 (6.5.8-1) unstable; urgency=medium

* Improved String.indexOf, String.rindexOf algorism. Fixed bug of shell
mode. Fixed bug of Command Class

clover2 (6.5.7-1) unstable; urgency=medium

* Improvement of JIT.
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Section: unknown
Priority: optional
Maintainer: Daisuke Minato <[email protected]>
Build-Depends: debhelper (>= 9), autotools-dev, libpcre3-dev, libreadline-dev, clang, libreadline7
Standards-Version: 6.5.7
Standards-Version: 6.5.8
Homepage: https://github.com/ab25cq/clover2/wiki
Vcs-Git: https://github.com/ab25cq/clover2.git

Expand Down
6 changes: 3 additions & 3 deletions debian/files
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
clover2-dbgsym_6.5.7-1_amd64.deb debug extra
clover2_6.5.7-1_amd64.buildinfo unknown optional
clover2_6.5.7-1_amd64.deb unknown optional
clover2-dbgsym_6.5.8-1_amd64.deb debug extra
clover2_6.5.8-1_amd64.buildinfo unknown optional
clover2_6.5.8-1_amd64.deb unknown optional
8 changes: 8 additions & 0 deletions manual/changelog-en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

version 6.5.8

Improved String.indexOf, String.rindexOf algorism

Fixed bug of shell mode

Fixed bug of Command Class

version 6.5.7

Improvement of JIT.
Expand Down
8 changes: 8 additions & 0 deletions manual/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
English page is here [>> English page](changelog-en)

version 6.5.8

Improved String.indexOf, String.rindexOf algorism

Fixed bug of shell mode

Fixed bug of Command Class

version 6.5.7

JITの改良。
Expand Down
2 changes: 1 addition & 1 deletion src/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static BOOL class_compiler(char* fname)

int gARGC;
char** gARGV;
char* gVersion = "6.5.7";
char* gVersion = "6.5.8";

char gScriptDirPath[PATH_MAX];
BOOL gRunningCompiler = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2454,7 +2454,7 @@ static void compiler_final()

int gARGC;
char** gARGV;
char* gVersion = "6.5.7";
char* gVersion = "6.5.8";

char gScriptDirPath[PATH_MAX];
BOOL gRunningCompiler = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static void set_signal()

int gARGC;
char** gARGV;
char* gVersion = "6.5.7";
char* gVersion = "6.5.8";
BOOL gCompilingCore = FALSE;

char gScriptDirPath[PATH_MAX];
Expand Down
19 changes: 18 additions & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ static BOOL parse_command_method_params(int* num_params, unsigned int* params, s

BOOL squort = FALSE;
BOOL dquort = FALSE;
BOOL quoted_string = FALSE;

while(1) {
if(!squort && *info->p == '$') {
Expand Down Expand Up @@ -525,10 +526,16 @@ static BOOL parse_command_method_params(int* num_params, unsigned int* params, s
else if(!squort && *info->p == '"') {
info->p++;
dquort = !dquort;
if(dquort) {
quoted_string = TRUE;
}
}
else if(!dquort && *info->p == '\'') {
info->p++;
squort = !squort;
if(squort) {
quoted_string = TRUE;
}
}
else if(squort || dquort) {
sBuf_append_char(&param, *info->p);
Expand All @@ -549,14 +556,24 @@ static BOOL parse_command_method_params(int* num_params, unsigned int* params, s
unsigned int node = 0;
node = sNodeTree_create_string_value(MANAGED param.mBuf, NULL, NULL, 0, info);

unsigned int node2 = 0;
node2 = sNodeTree_create_int_value(quoted_string, 0, 0, 0, info);
if(quoted_string) {
node2 = sNodeTree_true_expression(info);
}
else {
node2 = sNodeTree_false_expression(info);
}

sNodeType* command_class = create_node_type_with_class_name("Command");

MASSERT(command_class != NULL);

unsigned int params2[PARAMS_MAX];
int num_params2 = 1;
int num_params2 = 2;

params2[0] = node;
params2[1] = node2;

node = sNodeTree_create_class_method_call(command_class, "expandArg", params2, num_params2, info);

Expand Down
9 changes: 9 additions & 0 deletions z.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ls -al | less
pwd | less
vim src/main.c

initscr();
keypad(stdscr, true);
noecho();
getch();
endwin();

0 comments on commit 3b4c72f

Please sign in to comment.