Skip to content

Commit

Permalink
Doc updates and bug fixes. (#153)
Browse files Browse the repository at this point in the history
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 <matjoh@microsoft.com>
  • Loading branch information
matajoh authored Jun 24, 2024
1 parent cfabe01 commit b9278ad
Show file tree
Hide file tree
Showing 19 changed files with 207 additions and 111 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pr_gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,41 @@ jobs:
working-directory: ${{github.workspace}}/wrappers/python/
run: pytest -vv

linux-cheriot:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: CHERIoT-Platform/cheriot-audit
path: cheriot-audit

- uses: mjp41/workaround8649@c8550b715ccdc17f89c8d5c28d7a48eeff9c94a8

- name: Get dependencies
run: |
sudo apt-get install ninja-build
- name: Git config for fetching pull requests
run: |
git config --global --add remote.origin.fetch +refs/pull/*/merge:refs/remotes/pull/*
- name: CMake config
working-directory: ${{github.workspace}}/cheriot-audit
run: cmake -B ${{github.workspace}}/cheriot-audit/build -DCMAKE_BUILD_TYPE=Release -G Ninja
env:
REGOCPP_REPO: https://github.com/${{github.repository}}
REGOCPP_TAG: ${{github.sha}}

- name: CMake build
working-directory: ${{github.workspace}}/cheriot-audit/build
run: NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" && ninja

- name: CMake test
working-directory: ${{github.workspace}}/cheriot-audit/build
run: ctest -j4 --output-on-failure

windows:
runs-on: windows-latest

Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 2024-06-23 - Version 0.4.1
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

## 2024-06-14 - Hardening
Hardening for the 0.4.0 release.

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ FetchContent_Declare(
FetchContent_Declare(
trieste
GIT_REPOSITORY https://github.com/microsoft/trieste
GIT_TAG 37b1b35fb19db799367d1ca1a82273d8d268695d
GIT_TAG 6bb2ccffc5b8c21c90348c07a2c8a46316faba19
)

FetchContent_MakeAvailable(cmake_utils)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ some example commands using the provided example files and run from the suggeste
`dist` install directory:

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

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

./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]]"
[{"bar": "Foo", "baz": 5, "be": true, "bop": 23.4}, "20", {"name": "smoke1"}]
{"expressions":[[{"bar":"Foo", "baz":5, "be":true, "bop":23.4}, "20", {"name":"smoke1"}]]}

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

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

You can run the test driver from the same directory:

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.4.1
2 changes: 2 additions & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY
)

configure_file(regocpp-logo-48.png ${CMAKE_CURRENT_BINARY_DIR}/regocpp-logo-48.png COPYONLY)

add_custom_target( regocpp_doc
ALL
${DOXYGEN_EXECUTABLE}
Expand Down
59 changes: 1 addition & 58 deletions doc/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PROJECT_BRIEF = A C++ implementation of the Rego language and runtime
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.

PROJECT_LOGO =
PROJECT_LOGO = regocpp-logo-48.png

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

HTML_COLORSTYLE_GAMMA = 80

# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to YES can help to show when doxygen was last run and thus if the
# documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

HTML_TIMESTAMP = NO

# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via JavaScript. If disabled, the navigation index will
Expand Down Expand Up @@ -1621,17 +1612,6 @@ HTML_FORMULA_FORMAT = png

FORMULA_FONTSIZE = 10

# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
# Note that when changing this option you need to delete any form_*.png files in
# the HTML output directory before the changes have effect.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.

FORMULA_TRANSPARENT = YES

# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
Expand Down Expand Up @@ -1943,14 +1923,6 @@ LATEX_HIDE_INDICES = NO

LATEX_BIB_STYLE = plain

# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.

LATEX_TIMESTAMP = NO

# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
# path from which the emoji images will be read. If a relative path is entered,
# it will be relative to the LATEX_OUTPUT directory. If left blank the
Expand Down Expand Up @@ -2321,23 +2293,6 @@ HAVE_DOT = YES

DOT_NUM_THREADS = 0

# When you want a differently looking font in the dot files that doxygen
# generates you can specify the font name using DOT_FONTNAME. You need to make
# sure dot is able to find the font, which can be done by putting it in a
# standard location or by setting the DOTFONTPATH environment variable or by
# setting DOT_FONTPATH to the directory containing the font.
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_FONTNAME = Helvetica

# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
# Minimum value: 4, maximum value: 24, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_FONTSIZE = 10

# By default doxygen will tell dot to use the default font as specified with
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
# the path where dot can find it using this tag.
Expand Down Expand Up @@ -2574,18 +2529,6 @@ DOT_GRAPH_MAX_NODES = 50

MAX_DOT_GRAPH_DEPTH = 0

# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not seem
# to support this out of the box.
#
# Warning: Depending on the platform used, enabling this option may lead to
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
# read).
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.

DOT_TRANSPARENT = NO

# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
Expand Down
Binary file added doc/favicon.ico
Binary file not shown.
Binary file added doc/regocpp-logo-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions doc/regocpp-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regorust = "0.3.11"
regorust = "0.4.0"
clap = { version = "4.0", features = ["derive"] }
5 changes: 5 additions & 0 deletions src/parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ namespace rego
// ignore leading whitespace
},

R"(#[^\r\n]*\r?\n)" >>
[](auto&) {
// ignore leading comments
},

R"(package)" >>
[newline_mode](auto& m) {
m.push(Module);
Expand Down
36 changes: 19 additions & 17 deletions src/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1323,8 +1323,8 @@ namespace
wf_rules,
dir::bottomup | dir::once,
{
In(Group)([](auto& n) { return in_parent(n, Module); }) *
((T(Expr)[Rule]
In(Group) *
((T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(ExprInfix)
<< ((T(Expr)
<< (T(Term)
Expand Down Expand Up @@ -1360,8 +1360,8 @@ namespace
<< (RuleBodySeq << _[RuleBodySeq]);
},

In(Group)([](auto& n) { return in_parent(n, Module); }) *
((T(Expr)[Rule]
In(Group) *
((T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(Term)
<< (T(Ref)
<< ((T(RefHead) << T(Var)[RuleRef]) *
Expand Down Expand Up @@ -1407,9 +1407,9 @@ namespace
return Rule << False << rulehead << (RuleBodySeq << _[RuleBodySeq]);
},

In(Group)([](auto& n) { return in_parent(n, Module); }) *
In(Group) *
(~T(Default)[Default] *
(T(Expr)[Rule]
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(ExprInfix)
<< ((T(Expr) << (T(Term) << T(Ref)[RuleRef])) *
(T(InfixOperator) << T(AssignOperator)) *
Expand All @@ -1430,10 +1430,11 @@ namespace
<< (RuleBodySeq << _[RuleBodySeq]);
},

In(Group)([](auto& n) { return in_parent(n, Module); }) *
In(Group) *
(~T(Default)[Default] *
(T(Expr)[Rule] << (T(Term) << T(Ref)[RuleRef])) * ~T(If)[If] *
T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(Term) << T(Ref)[RuleRef])) *
~T(If)[If] * T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
[strict](Match& _) {
if (*strict && _(If) == nullptr && !_[RuleBodySeq].empty())
{
Expand All @@ -1452,9 +1453,9 @@ namespace
<< (RuleBodySeq << _[RuleBodySeq]);
},

In(Group)([](auto& n) { return in_parent(n, Module); }) *
In(Group) *
(~T(Default)[Default] *
(T(Expr)[Rule]
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(ExprInfix)
<< ((T(Expr)
<< (T(ExprCall)
Expand All @@ -1479,9 +1480,9 @@ namespace
<< (RuleBodySeq << _[RuleBodySeq]);
},

In(Group)([](auto& n) { return in_parent(n, Module); }) *
In(Group) *
(~T(Default)[Default] *
(T(Expr)[Rule]
(T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(ExprCall) << (T(Ref)[RuleRef] * T(ExprSeq)[RuleArgs]))) *
~T(If)[If] * T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
[strict](Match& _) {
Expand All @@ -1503,10 +1504,11 @@ namespace
<< (RuleBodySeq << _[RuleBodySeq]);
},

In(Group)([](auto& n) { return in_parent(n, Module); }) *
((T(Expr)[Rule] << (T(Term) << (T(Ref)[RuleRef]))) * T(Contains) *
T(Expr)[Expr] * ~T(If)[If] * T(Query, Else)++[RuleBodySeq] *
T(NewLine)) >>
In(Group) *
((T(Expr)[Rule]([](auto& n) { return in_parent(n, Module); })
<< (T(Term) << (T(Ref)[RuleRef]))) *
T(Contains) * T(Expr)[Expr] * ~T(If)[If] *
T(Query, Else)++[RuleBodySeq] * T(NewLine)) >>
[strict](Match& _) {
if (*strict && _(If) == nullptr && !_[RuleBodySeq].empty())
{
Expand Down
Loading

0 comments on commit b9278ad

Please sign in to comment.