Skip to content

Commit b9278ad

Browse files
authored
Doc updates and bug fixes. (#153)
Point release containing doc updates and bug fixes. - Updated the docs to reflect the new interfaces and outputs **Bug Fixes** - Fixed an issue with actions attached to an `In` statement for some builds/environments - Fixed a bug with modules that start with comments - Fixed a bug with comprehension contexts when an assigned variable is shadowed in the body of the comprehension - Bumping Trieste and adding the cheriot tests --------- Signed-off-by: Matthew A Johnson <[email protected]>
1 parent cfabe01 commit b9278ad

19 files changed

+207
-111
lines changed

.github/workflows/pr_gate.yml

+35
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,41 @@ jobs:
165165
working-directory: ${{github.workspace}}/wrappers/python/
166166
run: pytest -vv
167167

168+
linux-cheriot:
169+
runs-on: ubuntu-latest
170+
171+
steps:
172+
- name: Checkout
173+
uses: actions/checkout@v4
174+
with:
175+
repository: CHERIoT-Platform/cheriot-audit
176+
path: cheriot-audit
177+
178+
- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8
179+
180+
- name: Get dependencies
181+
run: |
182+
sudo apt-get install ninja-build
183+
184+
- name: Git config for fetching pull requests
185+
run: |
186+
git config --global --add remote.origin.fetch +refs/pull/*/merge:refs/remotes/pull/*
187+
188+
- name: CMake config
189+
working-directory: ${{github.workspace}}/cheriot-audit
190+
run: cmake -B ${{github.workspace}}/cheriot-audit/build -DCMAKE_BUILD_TYPE=Release -G Ninja
191+
env:
192+
REGOCPP_REPO: https://github.com/${{github.repository}}
193+
REGOCPP_TAG: ${{github.sha}}
194+
195+
- name: CMake build
196+
working-directory: ${{github.workspace}}/cheriot-audit/build
197+
run: NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" && ninja
198+
199+
- name: CMake test
200+
working-directory: ${{github.workspace}}/cheriot-audit/build
201+
run: ctest -j4 --output-on-failure
202+
168203
windows:
169204
runs-on: windows-latest
170205

CHANGELOG

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 2024-06-23 - Version 0.4.1
4+
Point release containing doc updates and bug fixes.
5+
6+
- Updated the docs to reflect the new interfaces and outputs
7+
8+
**Bug Fixes**
9+
- Fixed an issue with actions attached to an `In` statement for some builds/environments
10+
- Fixed a bug with modules that start with comments
11+
- Fixed a bug with comprehension contexts when an assigned variable is shadowed in the body of the comprehension
12+
313
## 2024-06-14 - Hardening
414
Hardening for the 0.4.0 release.
515

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ FetchContent_Declare(
9393
FetchContent_Declare(
9494
trieste
9595
GIT_REPOSITORY https://github.com/microsoft/trieste
96-
GIT_TAG 37b1b35fb19db799367d1ca1a82273d8d268695d
96+
GIT_TAG 6bb2ccffc5b8c21c90348c07a2c8a46316faba19
9797
)
9898

9999
FetchContent_MakeAvailable(cmake_utils)

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ some example commands using the provided example files and run from the suggeste
5151
`dist` install directory:
5252

5353
./bin/rego -d examples/scalars.rego -q data.scalars.greeting
54-
"Hello"
54+
{"expressions":["Hello"]}
5555

5656
./bin/rego -d examples/objects.rego -q data.objects.sites[1].name
57-
"smoke1"
57+
{"expressions":["smoke1"]}
5858

5959
./bin/rego -d examples/data0.json examples/data1.json examples/objects.rego -i examples/input0.json -q "[data.one, input.b, data.objects.sites[1]]"
60-
[{"bar": "Foo", "baz": 5, "be": true, "bop": 23.4}, "20", {"name": "smoke1"}]
60+
{"expressions":[[{"bar":"Foo", "baz":5, "be":true, "bop":23.4}, "20", {"name":"smoke1"}]]}
6161

6262
./bin/rego -q "5 + (2 - 4 * 0.25) * -3 + 7.4"
63-
9.4
63+
{"bindings":{"x":5, "y":9.4}}
6464

6565
./bin/rego -d examples/bodies.rego -i examples/input1.json -q data.bodies.e
66-
{"one": 15, "two": 15}
66+
{"expressions":[{"one":15, "two":15}]}
6767

6868
You can run the test driver from the same directory:
6969

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.0
1+
0.4.1

doc/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ configure_file(
44
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY
55
)
66

7+
configure_file(regocpp-logo-48.png ${CMAKE_CURRENT_BINARY_DIR}/regocpp-logo-48.png COPYONLY)
8+
79
add_custom_target( regocpp_doc
810
ALL
911
${DOXYGEN_EXECUTABLE}

doc/Doxyfile.in

+1-58
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PROJECT_BRIEF = A C++ implementation of the Rego language and runtime
5151
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
5252
# the logo to the output directory.
5353

54-
PROJECT_LOGO =
54+
PROJECT_LOGO = regocpp-logo-48.png
5555

5656
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
5757
# into which the generated documentation will be written. If a relative path is
@@ -1318,15 +1318,6 @@ HTML_COLORSTYLE_SAT = 100
13181318

13191319
HTML_COLORSTYLE_GAMMA = 80
13201320

1321-
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
1322-
# page will contain the date and time when the page was generated. Setting this
1323-
# to YES can help to show when doxygen was last run and thus if the
1324-
# documentation is up to date.
1325-
# The default value is: NO.
1326-
# This tag requires that the tag GENERATE_HTML is set to YES.
1327-
1328-
HTML_TIMESTAMP = NO
1329-
13301321
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
13311322
# documentation will contain a main index with vertical navigation menus that
13321323
# are dynamically created via JavaScript. If disabled, the navigation index will
@@ -1621,17 +1612,6 @@ HTML_FORMULA_FORMAT = png
16211612

16221613
FORMULA_FONTSIZE = 10
16231614

1624-
# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
1625-
# generated for formulas are transparent PNGs. Transparent PNGs are not
1626-
# supported properly for IE 6.0, but are supported on all modern browsers.
1627-
#
1628-
# Note that when changing this option you need to delete any form_*.png files in
1629-
# the HTML output directory before the changes have effect.
1630-
# The default value is: YES.
1631-
# This tag requires that the tag GENERATE_HTML is set to YES.
1632-
1633-
FORMULA_TRANSPARENT = YES
1634-
16351615
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
16361616
# to create new LaTeX commands to be used in formulas as building blocks. See
16371617
# the section "Including formulas" for details.
@@ -1943,14 +1923,6 @@ LATEX_HIDE_INDICES = NO
19431923

19441924
LATEX_BIB_STYLE = plain
19451925

1946-
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
1947-
# page will contain the date and time when the page was generated. Setting this
1948-
# to NO can help when comparing the output of multiple runs.
1949-
# The default value is: NO.
1950-
# This tag requires that the tag GENERATE_LATEX is set to YES.
1951-
1952-
LATEX_TIMESTAMP = NO
1953-
19541926
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
19551927
# path from which the emoji images will be read. If a relative path is entered,
19561928
# it will be relative to the LATEX_OUTPUT directory. If left blank the
@@ -2321,23 +2293,6 @@ HAVE_DOT = YES
23212293

23222294
DOT_NUM_THREADS = 0
23232295

2324-
# When you want a differently looking font in the dot files that doxygen
2325-
# generates you can specify the font name using DOT_FONTNAME. You need to make
2326-
# sure dot is able to find the font, which can be done by putting it in a
2327-
# standard location or by setting the DOTFONTPATH environment variable or by
2328-
# setting DOT_FONTPATH to the directory containing the font.
2329-
# The default value is: Helvetica.
2330-
# This tag requires that the tag HAVE_DOT is set to YES.
2331-
2332-
DOT_FONTNAME = Helvetica
2333-
2334-
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
2335-
# dot graphs.
2336-
# Minimum value: 4, maximum value: 24, default value: 10.
2337-
# This tag requires that the tag HAVE_DOT is set to YES.
2338-
2339-
DOT_FONTSIZE = 10
2340-
23412296
# By default doxygen will tell dot to use the default font as specified with
23422297
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
23432298
# the path where dot can find it using this tag.
@@ -2574,18 +2529,6 @@ DOT_GRAPH_MAX_NODES = 50
25742529

25752530
MAX_DOT_GRAPH_DEPTH = 0
25762531

2577-
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
2578-
# background. This is disabled by default, because dot on Windows does not seem
2579-
# to support this out of the box.
2580-
#
2581-
# Warning: Depending on the platform used, enabling this option may lead to
2582-
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
2583-
# read).
2584-
# The default value is: NO.
2585-
# This tag requires that the tag HAVE_DOT is set to YES.
2586-
2587-
DOT_TRANSPARENT = NO
2588-
25892532
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
25902533
# files in one run (i.e. multiple -o and -T options on the command line). This
25912534
# makes dot run faster, but since only newer versions of dot (>1.8.10) support

doc/favicon.ico

1.12 KB
Binary file not shown.

doc/regocpp-logo-48.png

1.08 KB
Loading

doc/regocpp-logo.svg

+6
Loading

examples/rust/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
regorust = "0.3.11"
9+
regorust = "0.4.0"
1010
clap = { version = "4.0", features = ["derive"] }

src/parse.cc

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ namespace rego
6363
// ignore leading whitespace
6464
},
6565

66+
R"(#[^\r\n]*\r?\n)" >>
67+
[](auto&) {
68+
// ignore leading comments
69+
},
70+
6671
R"(package)" >>
6772
[newline_mode](auto& m) {
6873
m.push(Module);

src/reader.cc

+19-17
Original file line numberDiff line numberDiff line change
@@ -1323,8 +1323,8 @@ namespace
13231323
wf_rules,
13241324
dir::bottomup | dir::once,
13251325
{
1326-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1327-
((T(Expr)[Rule]
1326+
In(Group) *
1327+
((T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
13281328
<< (T(ExprInfix)
13291329
<< ((T(Expr)
13301330
<< (T(Term)
@@ -1360,8 +1360,8 @@ namespace
13601360
<< (RuleBodySeq << _[RuleBodySeq]);
13611361
},
13621362

1363-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1364-
((T(Expr)[Rule]
1363+
In(Group) *
1364+
((T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
13651365
<< (T(Term)
13661366
<< (T(Ref)
13671367
<< ((T(RefHead) << T(Var)[RuleRef]) *
@@ -1407,9 +1407,9 @@ namespace
14071407
return Rule << False << rulehead << (RuleBodySeq << _[RuleBodySeq]);
14081408
},
14091409

1410-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1410+
In(Group) *
14111411
(~T(Default)[Default] *
1412-
(T(Expr)[Rule]
1412+
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
14131413
<< (T(ExprInfix)
14141414
<< ((T(Expr) << (T(Term) << T(Ref)[RuleRef])) *
14151415
(T(InfixOperator) << T(AssignOperator)) *
@@ -1430,10 +1430,11 @@ namespace
14301430
<< (RuleBodySeq << _[RuleBodySeq]);
14311431
},
14321432

1433-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1433+
In(Group) *
14341434
(~T(Default)[Default] *
1435-
(T(Expr)[Rule] << (T(Term) << T(Ref)[RuleRef])) * ~T(If)[If] *
1436-
T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
1435+
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
1436+
<< (T(Term) << T(Ref)[RuleRef])) *
1437+
~T(If)[If] * T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
14371438
[strict](Match& _) {
14381439
if (*strict && _(If) == nullptr && !_[RuleBodySeq].empty())
14391440
{
@@ -1452,9 +1453,9 @@ namespace
14521453
<< (RuleBodySeq << _[RuleBodySeq]);
14531454
},
14541455

1455-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1456+
In(Group) *
14561457
(~T(Default)[Default] *
1457-
(T(Expr)[Rule]
1458+
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
14581459
<< (T(ExprInfix)
14591460
<< ((T(Expr)
14601461
<< (T(ExprCall)
@@ -1479,9 +1480,9 @@ namespace
14791480
<< (RuleBodySeq << _[RuleBodySeq]);
14801481
},
14811482

1482-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1483+
In(Group) *
14831484
(~T(Default)[Default] *
1484-
(T(Expr)[Rule]
1485+
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
14851486
<< (T(ExprCall) << (T(Ref)[RuleRef] * T(ExprSeq)[RuleArgs]))) *
14861487
~T(If)[If] * T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
14871488
[strict](Match& _) {
@@ -1503,10 +1504,11 @@ namespace
15031504
<< (RuleBodySeq << _[RuleBodySeq]);
15041505
},
15051506

1506-
In(Group)([](auto& n) { return in_parent(n, Module); }) *
1507-
((T(Expr)[Rule] << (T(Term) << (T(Ref)[RuleRef]))) * T(Contains) *
1508-
T(Expr)[Expr] * ~T(If)[If] * T(Query, Else)++[RuleBodySeq] *
1509-
T(NewLine)) >>
1507+
In(Group) *
1508+
((T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
1509+
<< (T(Term) << (T(Ref)[RuleRef]))) *
1510+
T(Contains) * T(Expr)[Expr] * ~T(If)[If] *
1511+
T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
15101512
[strict](Match& _) {
15111513
if (*strict && _(If) == nullptr && !_[RuleBodySeq].empty())
15121514
{

0 commit comments

Comments
 (0)