Skip to content

Commit

Permalink
Merge pull request #326 from veelo/ci-dip1000
Browse files Browse the repository at this point in the history
Test DIP 1000
  • Loading branch information
veelo authored Feb 28, 2023
2 parents 3dedcd4 + 7b9d8c1 commit d5d27f0
Show file tree
Hide file tree
Showing 30 changed files with 85 additions and 20 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/d.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Run all D Tests
on: [push, pull_request]

jobs:
test:
name: Dub Tests
unittest:
name: Pegged unit tests
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
Expand All @@ -27,3 +27,26 @@ jobs:

- name: Run tests
run: dub -q test

examples:
name: Examples unit tests
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dc: [dmd-2.101.2] # Avoid https://dlang.org/changelog/2.102.0.html#build-cache
example: [arithmetic, csv, json, numbers, python, simple_arithmetic, strings, xml]
exclude:
# out of memory
- { example: python }

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- name: Install D compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}

- name: Test example
run: dub test :${{ matrix.example }}
8 changes: 6 additions & 2 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
],
"subPackages": [
"examples/arithmetic",
"examples/composition",
"examples/csv",
"examples/json",
"examples/numbers",
"examples/python",
"examples/simple_arithmetic",
"examples/strings",
"examples/csv",
"examples/json"
"examples/xml"
]
}
3 changes: 2 additions & 1 deletion examples/PEG/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
3 changes: 2 additions & 1 deletion examples/arithmetic/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/arithmetic/src/pegged/examples/arithmetic.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import std.conv: to;

import pegged.grammar;

@safe:

mixin(grammar(`
# Arithmetic grammar with variable terminal
Arithmetic:
Expand Down
3 changes: 2 additions & 1 deletion examples/c/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
3 changes: 2 additions & 1 deletion examples/composition/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/composition/src/pegged/examples/composition.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module pegged.examples.composition;
import pegged.grammar;
import pegged.examples.strings, pegged.examples.numbers;

@safe:

mixin(grammar(`
LOG:
LogFile <- LogLine+ eoi
Expand Down
3 changes: 2 additions & 1 deletion examples/csv/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/csv/src/pegged/examples/csv.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ version(unittest)
import std.stdio;
}

@safe:

mixin(grammar(`
CSV:
Expand Down
3 changes: 2 additions & 1 deletion examples/dgrammar/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
1 change: 1 addition & 0 deletions examples/extended_pascal/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"path": "../.."
}
},
"dflags": [ "-preview=dip1000" ],
"preGenerateCommands": [
"rdmd -I$PEGGED_PACKAGE_DIR source/make.d"
],
Expand Down
3 changes: 2 additions & 1 deletion examples/json/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/json/src/pegged/examples/json.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module pegged.examples.json;

import pegged.grammar;

@safe:

mixin(grammar(`
JSON:
JSONObject < :'{' (Pair (:',' Pair)*)? :'}'
Expand Down
3 changes: 2 additions & 1 deletion examples/markdown/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
3 changes: 2 additions & 1 deletion examples/misc/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
3 changes: 2 additions & 1 deletion examples/numbers/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/numbers/src/pegged/examples/numbers.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module pegged.examples.numbers;

import pegged.grammar;

@safe:

/// Numbers
mixin(grammar(`
Numbers:
Expand Down
3 changes: 2 additions & 1 deletion examples/oberon2/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
3 changes: 2 additions & 1 deletion examples/parameterized/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
3 changes: 2 additions & 1 deletion examples/peggedgrammar/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
1 change: 1 addition & 0 deletions examples/python/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"path": "../.."
}
},
"dflags": [ "-preview=dip1000" ],
"dflags-dmd": [ "-lowmem" ],
"dflags-ldc": [ "--lowmem" ]
}
2 changes: 2 additions & 0 deletions examples/python/src/pegged/examples/python.d
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module pegged.examples.python;

import pegged.grammar;

@safe:

// https://docs.python.org/3/reference/grammar.html
// 3.10.3 Documentation » The Python Language Reference » 10. Full Grammar specification
enum string pythonGrammar = `
Expand Down
3 changes: 2 additions & 1 deletion examples/simple_arithmetic/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import std.conv: to;

import pegged.grammar;

@safe:

mixin(grammar(`
Arithmetic:
Term < Factor (Add / Sub)*
Expand Down
3 changes: 2 additions & 1 deletion examples/strings/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/strings/src/pegged/examples/strings.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module pegged.examples.strings;

import pegged.grammar;

@safe:

mixin(grammar(`
String:
# Example of a rule for double-quoted strings
Expand Down
3 changes: 2 additions & 1 deletion examples/xml/dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"version": "*",
"path": "../.."
}
}
},
"dflags": [ "-preview=dip1000" ]
}
2 changes: 2 additions & 0 deletions examples/xml/src/pegged/examples/xml.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import pegged.grammar;

import std.array;

@safe:

string[] nameStack;

/// Semantic action to push a tag name on a stack
Expand Down
2 changes: 2 additions & 0 deletions examples/xml/src/pegged/examples/xml2.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module pegged.examples.xml2;

import pegged.grammar;

@safe:

enum XMLgrammar = `
XML:
Expand Down

0 comments on commit d5d27f0

Please sign in to comment.