Skip to content

Commit 43001ee

Browse files
committed
Merge branch 'develop'
2 parents 89a20d4 + 0150755 commit 43001ee

72 files changed

Lines changed: 3918 additions & 1794 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
- develop
8+
- trial
89
pull_request:
910
branches:
1011
- main
@@ -39,20 +40,23 @@ jobs:
3940
sudo ./install.sh /usr/local
4041
)
4142
42-
- name: Install uncrustify for x64 architecture
43-
if: ${{ runner.arch }} == "X64"
44-
run: |
45-
(
46-
curl -LO http://launchpadlibrarian.net/516341795/uncrustify_0.72.0+dfsg1-2_amd64.deb &&
47-
sudo dpkg -i uncrustify_0.72.0+dfsg1-2_amd64.deb || true
48-
)
43+
- name: Set up Python
44+
# required for build of uncrustify
45+
uses: actions/setup-python@v6
46+
with:
47+
python-version: "3.12"
4948

50-
- name: Install uncrustify for Arm64 architecture
51-
if: ${{ runner.arch }} == "ARM64"
49+
- name: Install uncrustify
5250
run: |
5351
(
54-
curl -LO http://launchpadlibrarian.net/516341795/uncrustify_0.72.0+dfsg1-2_arm64.deb &&
55-
sudo dpkg -i uncrustify_0.72.0+dfsg1-2_arm64.deb || true
52+
git clone https://github.com/uncrustify/uncrustify.git &&
53+
cd uncrustify &&
54+
git checkout uncrustify-0.72.0 &&
55+
mkdir build &&
56+
cd build &&
57+
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release .. &&
58+
cmake --build . --config Release &&
59+
sudo cmake --install . --config Release
5660
)
5761
5862
- name: Checkout code

README.md

Lines changed: 107 additions & 41 deletions
Large diffs are not rendered by default.

examples/ast-tinyc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.2)
1+
cmake_minimum_required(VERSION 3.14)
22

33
project(ast)
44

examples/ast-tinyc/README.md

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,72 +19,27 @@ So, you can use it freely without noticing the copyright of the original author.
1919

2020
## How to compile this example ##
2121

22-
### For Unix-like OS ###
23-
2422
You can get the executable by executing the following commands:
2523

2624
```
2725
cd /path/to/this_directory
2826
mkdir build
2927
cd build
3028
cmake -DPACKCC=/path/to/packcc ..
31-
make
32-
```
33-
34-
Here, `/path/to/this_directory` represents the path name of this directory,
35-
and `/path/to/packcc` represents the path name of `packcc` command.
36-
If `packcc` command is installed in one of the directories specified in the environment variable `PATH`,
37-
the option `-DPACKCC=/path/to/packcc` is not necessary.
38-
39-
The executable `ast` will be created in the directory `build`.
40-
41-
### For Windows ###
42-
43-
#### Using Visual Studio ####
44-
45-
You must have [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) installed in your system.
46-
You can get the executable by executing the following commands using 'Developer Command Prompt for VS 2019' or 'Developer PowerShell for VS 2019':
47-
48-
```
49-
cd \path\to\this_directory
50-
mkdir build
51-
cd build
52-
cmake -DPACKCC=\path\to\packcc ..
53-
MSBuild ALL_BUILD.vcxproj
54-
```
55-
56-
Here, `\path\to\this_directory` represents the path name of this directory,
57-
and `\path\to\packcc` represents the path name of `packcc` command.
58-
If `packcc` command is installed in one of the directories specified in the environment variable `PATH`,
59-
the option `-DPACKCC=\path\to\packcc` is not necessary.
60-
61-
The executable `ast.exe` will be created in the directory `build\Debug`.
62-
63-
#### Using MinGW-w64 ####
64-
65-
You can get the executable by executing the following commands:
66-
67-
```
68-
cd /path/to/this_directory
69-
mkdir build
70-
cd build
71-
cmake -G "MSYS Makefiles" -DPACKCC=/path/to/packcc ..
72-
make
29+
cmake --build .
7330
```
7431

75-
Here, `/path/to/this_directory` represents the path name of this directory,
76-
and `/path/to/packcc` represents the path name of `packcc` command.
77-
If `packcc` command is installed in one of the directories specified in the environment variable `PATH`,
78-
the option `-DPACKCC=/path/to/packcc` is not necessary.
32+
Here, `/path/to/this_directory` represents the path of this directory, and `/path/to/packcc` represents the path of `packcc` command.
33+
If `packcc` command is installed in one of the directories specified in the environment variable `PATH`, the option `-DPACKCC=/path/to/packcc` is not necessary.
7934

80-
The executable `ast.exe` will be created in the directory `build`.
35+
If using a build system for a Unix-like OS, MinGW, or Cygwin, which is typically `make`, the executable `ast` will be created in the current directory `build`. If using [Visual Studio](https://visualstudio.microsoft.com/) on Windows, it will be created in the directory `build\Debug`.
8136

8237
## How to run this example ##
8338

8439
Example input source files are prepared in [`inputs`](inputs) directory.
8540
Most of these are taken from [grammars-v4](https://github.com/antlr/grammars-v4/) repository of [ANTLR project](https://github.com/antlr/) with thanks.
8641

87-
Here, it is assumed that you are in the directory `build`.
42+
Here, we assume that you are in the directory `build`, and that the executable `ast` is in this directory.
8843
If you want to print out the AST of the input source file [`inputs/example2.c`](inputs/example2.c), execute the following command:
8944

9045
```

examples/ast-tinyc/main.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,9 @@ int main(int argc, char **argv) {
3333
system__open_source_file(&system, path);
3434
parser = parser_create(&system);
3535
ast_node_t *ast;
36-
const int b = parser_parse(parser, &ast);
36+
parser_parse(parser, &ast);
3737
if (system.source.ecount > 0) longjmp(system.jmp, 1); /* never returns */
38-
if (b) {
39-
ret = 10; /* internal error */
40-
fprintf(stderr, "FATAL: Internal error\n");
41-
/* <-- input text remaining due to incompleteness of the grammar */
42-
}
43-
else {
44-
system__dump_ast(&system, ast);
45-
}
38+
system__dump_ast(&system, ast);
4639
}
4740
else {
4841
ret = 2; /* error during parsing */

import/util/eol.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ The usage procedure is shown below.
4141
```
4242
In the example above, the line number and the column byte offset where each `word` starts are output.
4343
44-
**Notice:** Whenever parsing starts, the values of all marker variables are set to 0.
45-
4644
#### Example
4745
4846
An example which shows the line number and the column byte offset where each `word` starts is shown here.

import/util/tab.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ The usage procedure is shown below.
4141
```
4242
In the example above, `@tab_col` is set to 0 in advance, and `@tab_col` will have the column number at the position after the part matched by `TAB*`.
4343
44-
**Notice:** Whenever parsing starts, the values of all marker variables are set to 0.
45-
4644
#### Example
4745
4846
An example which shows column numbers of the respective input sequences of space and tab characters followed by `'\n'` is shown here.

0 commit comments

Comments
 (0)