Skip to content

Commit

Permalink
Merge pull request #83 from iewnfod/nightly
Browse files Browse the repository at this point in the history
Update to Stable
  • Loading branch information
lightumcc authored Mar 26, 2024
2 parents 926b50c + c3727b7 commit 9dd035a
Show file tree
Hide file tree
Showing 10 changed files with 22,170 additions and 21,634 deletions.
2 changes: 1 addition & 1 deletion CAIE-Code-Extension
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,35 @@ The following items give the `DATATYPE`, its description, and the default value
"BCD"
```
* `LCASE(ThisChar : CHAR) RETURNS CHAR`
> Decrapricated since 2023
```
$ LCASE('W')
'w'
```
* `UCASE(ThisChar : CHAR) RETURNS CHAR`
> Decrapricated since 2023
```
$ UCASE('h')
'H'
```
* `TO_UPPER(x : <datatype>) RETURNS <datatype>`
> <datatype> may be `CHAR` or `STRING`
```
$ TO_UPPER("hello")
"HELLO"
$ TO_UPPER('a')
'A'
```
* `TO_LOWER(x : <datatype>) RETURNS <datatype>`
> <datatype> may be `CHAR` or `STRING`
```
$ TO_LOWER("HELLO")
"hello"
$ TO_LOWER('A')
'a'
```
* `INT(x : REAL) RETURNS INTEGER`
```
$ INT(27.5415)
Expand All @@ -519,6 +539,37 @@ The following items give the `DATATYPE`, its description, and the default value
```
* `EOF(file_path : STRING) RETURNS BOOLEAN`
* `POW(x: REAL, y: REAL) RETURNS REAL`
* `DAY(ThisDate : DATE) RETURNS INTEGER`
```
$ DAY(25/07/2023)
25
```
* `MONTH(ThisDate : DATE) RETURNS INTEGER`
```
$ MONTH(25/07/2023)
7
```
* `YEAR(ThisDate : DATE) RETURNS INTEGER`
```
$ YEAR(12/12/2005)
2005
```
* `DAYINDEX(ThisDate : DATE) RETURNS INTEGER`
> Where Sunday = 1, Monday = 2 etc
```
$ DAYINDEX(25/03/2024)
2
```
* `SETDATE(day : INTEGER, month : INTEGER, year : INTEGER) RETURNS DATE`
```
$ SETDATE(25, 03, 2024)
25/03/2024
```
* `TODAY() RETURNS DATE`
```
$ TODAY()
25/03/2024
```

### Built-in Functions of this Interpreter
> These functions are fairly useful, but they are not included in the [CAIE standard](https://www.cambridgeinternational.org/Images/697401-2026-syllabus-legacy-notice.pdf).
Expand Down
52 changes: 52 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,35 @@ NEXT i
"BCD"
```
* `LCASE(ThisChar : CHAR) RETURNS CHAR`
> 从2023年开始弃用
```
$ LCASE('W')
'w'
```
* `UCASE(ThisChar : CHAR) RETURNS CHAR`
> 从2023年开始弃用
```
$ UCASE('h')
'H'
```
* `TO_UPPER(x : <datatype>) RETURNS <datatype>`
> <datatype> 可以是 `CAHR` 或者 `STRING`
```
$ TO_UPPER("hello")
"HELLO"
$ TO_UPPER('a')
'A'
```
* `TO_LOWER(x : <datatype>) RETURNS <datatype>`
> <datatype> 可以是 `CAHR` 或者 `STRING`
```
$ TO_LOWER("HELLO")
"hello"
$ TO_LOWER('A')
'a'
```
* `INT(x : REAL) RETURNS INTEGER`
```
$ INT(27.5415)
Expand All @@ -497,6 +517,38 @@ NEXT i
```
* `EOF(file_path : STRING) RETURNS BOOLEAN`
* `POW(x: REAL, y: REAL) RETURNS REAL`
* `DAY(ThisDate : DATE) RETURNS INTEGER`
```
$ DAY(25/07/2023)
25
```
* `MONTH(ThisDate : DATE) RETURNS INTEGER`
```
$ MONTH(25/07/2023)
7
```
* `YEAR(ThisDate : DATE) RETURNS INTEGER`
```
$ YEAR(12/12/2005)
2005
```
* `DAYINDEX(ThisDate : DATE) RETURNS INTEGER`
> 周日返回1,周一返回2,以此类推
```
$ DAYINDEX(25/03/2024)
2
```
* `SETDATE(day : INTEGER, month : INTEGER, year : INTEGER) RETURNS DATE`
```
$ SETDATE(25, 03, 2024)
25/03/2024
```
* `TODAY() RETURNS DATE`
```
$ TODAY()
25/03/2024
```


**(以下方法均不属于CAIE提供的标准方法)**
* `EXIT(code : INTEGER)` 以code为退出码,退出程序 (若不填写code,则默认为0)
Expand Down
43,125 changes: 21,690 additions & 21,435 deletions parser.out

Large diffs are not rendered by default.

277 changes: 139 additions & 138 deletions parsetab.py

Large diffs are not rendered by default.

Empty file added pyproject.toml
Empty file.
1 change: 1 addition & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
```
Time() RETURNS REAL
```

## [Import](./import.cpc)
* `Import`: import another *cpc* file
```
Expand Down
Loading

0 comments on commit 9dd035a

Please sign in to comment.