Skip to content

Commit

Permalink
Merge pull request #79 from iewnfod/nightly
Browse files Browse the repository at this point in the history
Update to Stable
  • Loading branch information
lightumcc authored Mar 11, 2024
2 parents 753c8b0 + 24e4a26 commit 926b50c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/string.cpc
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,7 @@ FUNCTION ORD(s : CHAR) RETURNS INTEGER
r <- PYTHON("_result=ord(s)", s)
RETURN r
ENDFUNCTION

FUNCTION SUBSTRING(s : STRING, start : INTEGER, size : INTEGER) RETURNS STRING
RETURN MID(s, start, size)
ENDFUNCTION
4 changes: 4 additions & 0 deletions src/AST/insert_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def exe(self):
c = parameters[0]
if c[1] == 'CHAR':
return (c[0].lower(), 'CHAR')
elif c[1] == 'STRING':
return (c[0].lower(), 'STRING')
else:
add_error_message(f'Function `{self.type}` expect `CHAR`, but found `{c[1]}`', self)

Expand All @@ -252,6 +254,8 @@ def exe(self):
c = parameters[0]
if c[1] == 'CHAR':
return (c[0].upper(), 'CHAR')
elif c[1] == 'STRING':
return (c[0].upper(), 'STRING')
else:
add_error_message(f'Function `{self.type}` expect `CHAR`, but found `{c[1]}`', self)

Expand Down

0 comments on commit 926b50c

Please sign in to comment.