Skip to content

Commit 88b46e3

Browse files
committed
Fix COMFLOWFileExistence as asked in #131
1 parent 1f4edb5 commit 88b46e3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

shell-rules/src/main/resources/lex/COMFLOWFileExistence.lex

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ OPERATOR_LEFT = [\<]|[\<][\&]|[\&][\<]|[\<][\<]|[\<][\<][\<]
6363
OPERATOR_RL = [\<][\>]
6464
RIGHT_FILE_REDIRECT = ({OPERATOR_RIGHT}|{OPERATOR_RL}){SPACE}*{FILESTRING}
6565
LEFT_FILE_REDIRECT = {FILESTRING}{SPACE}*({OPERATOR_LEFT}|{OPERATOR_RL})
66-
REDIRECT_IGNORE = ([0-2]({OPERATOR_LEFT}|{OPERATOR_RL})) | (({OPERATOR_RIGHT}|{OPERATOR_RL})[0-2])
66+
REDIRECT_IGNORE = ([0-2]({OPERATOR_LEFT}|{OPERATOR_RL})) | (({OPERATOR_RIGHT}|{OPERATOR_RL})[0-2]) | ("done"{SPACE}*({OPERATOR_LEFT}|{OPERATOR_RL}))
6767

6868

6969
STRING = [\"]|[\']
@@ -234,6 +234,7 @@ IGNORE = {REDIRECT_IGNORE} | {STRING_ESCAPED} | ([\\][\#]) | "ssh"
234234
String name = yytext().replaceAll("([\\s]|[\\>]|[\\\"]|[\\']|[\\<]|[\\&]|[\\{]|[\\}])+","");
235235
LOGGER.fine("["+this.parsedFileName+":"+(yyline+1)+":"+yycolumn+"] - Redirection to file "+name+" detected.");
236236
if(!filesExistence.contains(name)){
237+
System.err.println("A " + location + " The existence of the file " + name + " has not been checked. "+ (yyline+1));
237238
LOGGER.fine("["+this.parsedFileName+":"+(yyline+1)+":"+yycolumn+"] - setError on "+name+" file redirection.");
238239
setError(location,"The existence of the file " + name + " has not been checked.", yyline+1);
239240
}

shell-rules/src/test/resources/COM/FLOW/FileExistence/noError.sh

+4
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ while (( $STOP >= $START ))
3232
done
3333

3434
grep -v "P" $fichier | awk '($9>0.0) {print $0}'
35+
36+
while read -r line; do
37+
printf '%s\n' "$line"
38+
done < "$fichier"

0 commit comments

Comments
 (0)