forked from JacquesCarette/Drasil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'chemCode' into srsHacks
Remove mulRe from chemCode (see JacquesCarette#3812)
- Loading branch information
Showing
643 changed files
with
15,903 additions
and
5,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
on: | ||
pull_request: | ||
branches: master | ||
branches: main | ||
paths: 'code/drasil-**' | ||
name: Linter | ||
concurrency: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Wiki | ||
on: | ||
push: | ||
branches: [main] | ||
paths: [wiki/**, .github/workflows/Wiki.yaml] | ||
pull_request: | ||
branches: [main] | ||
paths: [wiki/**, .github/workflows/Wiki.yaml] | ||
permissions: | ||
contents: write | ||
jobs: | ||
check_directories: | ||
name: "Audit changes" | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "No new directories in ./wiki/" | ||
run: | | ||
if git diff --name-only --diff-filter=A origin/main... | grep -q '^wiki/.*/'; then | ||
echo "New directory detected in wiki folder. This is not allowed." | ||
exit 1 | ||
fi | ||
- name: "No manually added disclaimers" | ||
run: | | ||
notice='Warning: Wiki should not be edited directly' | ||
bad_files=$(grep -rl "$notice" wiki || true) | ||
if [ -n "$bad_files" ]; then | ||
echo "Edit disclaimers are automatically prepended. Please remove those manually added. Bad files:" | ||
echo "$bad_files" | ||
exit 1 | ||
fi | ||
- name: "Windows-friendly file names" | ||
run: | | ||
bad_file_names=$(find wiki -type f -name "*[\\/:*?\"<>|]*") | ||
if [ -n "$bad_file_names" ]; then | ||
echo "Windows-friendly file names must not contain any of \"\\/:*?\"<>|\". Bad files:" | ||
echo "$bad_file_names" | ||
exit 1 | ||
fi | ||
wiki: | ||
name: "Publish changes" | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: # Fetch enough history to resolve HEAD^ -- https://github.com/actions/checkout?tab=readme-ov-file#checkout-head | ||
fetch-depth: 2 | ||
|
||
- name: "Configure git client" | ||
run: | | ||
git config --global user.name "${{ secrets.BOT_NAME }}" | ||
git config --global user.email "${{ secrets.BOT_EMAIL }}" | ||
- name: "Prepend wiki edit warnings" | ||
run: | | ||
notice='_Warning: Wiki should not be edited directly. Edit the files in the ./wiki/ folder instead and make a PR._' | ||
for file in wiki/*.md; do | ||
[ "$(basename "$file")" = "_Sidebar.md" ] && continue | ||
sed -i '1s|^|'"$notice"'\n\n|' "$file" | ||
done | ||
- name: "Clone .wiki repository" | ||
run: | | ||
git clone https://x-access-token:${{ secrets.BOT_TOKEN }}@github.com/${{ github.repository }}.wiki.git | ||
- name: "Update ~.wiki.git contents" | ||
run: | | ||
rsync -av --delete --exclude '.git' wiki/ ${GITHUB_REPOSITORY##*/}.wiki/ | ||
- name: "Commit and push changes" | ||
run: | | ||
cd ${GITHUB_REPOSITORY##*/}.wiki | ||
git add . | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git commit -m "Update wiki content at ${{ github.sha }}" | ||
git push origin master | ||
else | ||
echo "No changes to commit" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
## Purpose: generates a template with unimplemented instances of all the classes | ||
# in the target file. | ||
# Instructions: Modify the strings under # Inputs: inFilePath, outFilePath, oldName, newName. | ||
# inFilePath should be a path to an existing renderer (e.g. SwiftRenderer.hs) | ||
# oldName should be the name of the main type for the existing renderer (e.g. SwiftRenderer) | ||
# newFilePath and newName should be pretty self-explanatory. | ||
# Then run the file with your python3 interpreter. | ||
# Created by Brandon Bosman | ||
# Date: May 16, 2024 | ||
|
||
# Inputs | ||
inFilePath = "drasil-gool/lib/GOOL/Drasil/LanguageRenderer/SwiftRenderer.hs" | ||
outFilePath = "drasil-gool/lib/GOOL/Drasil/LanguageRenderer/TemplateJuliaRenderer.hs" | ||
oldName = "SwiftCode" | ||
newName = "JuliaCode" | ||
|
||
# The datatype for an instance: it has a declaration, some types, and some methods | ||
def newInstance(line: str): | ||
return { | ||
"declaration" : line.replace(oldName, newName), | ||
"types" : [], | ||
"methods" : [] | ||
} | ||
|
||
# Read file | ||
with open(inFilePath, "r") as inFile: | ||
lines = inFile.readlines() | ||
|
||
# Go through lines and find instances of typeclasses | ||
instances = [] | ||
inInstance = False | ||
|
||
for line in lines: | ||
|
||
# Detect an instance declaration | ||
if line.startswith("instance"): | ||
inInstance = True | ||
instances.append(newInstance(line)) | ||
continue | ||
|
||
if inInstance: | ||
|
||
# Unindented code means the current instance is finished | ||
if not line.isspace() and not line.startswith(" "): | ||
inInstance = False | ||
print("Not instance: " + line) | ||
continue | ||
|
||
# Skim over blank lines and lines indented more than once | ||
if line.isspace(): | ||
print("All space: " + line) | ||
continue | ||
|
||
if len(line) > 2 and line[2] == " ": | ||
print("Nested indent: " + line) | ||
continue | ||
|
||
start = 2 # the first character after the indent | ||
|
||
# Add types and methods | ||
if line[start:].startswith("type"): | ||
instances[-1]["types"].append(line.replace(oldName, newName)) | ||
else: | ||
# Add everything before the 'main' = sign ('main' determined by | ||
# brackets), then add undefined after the = sign. | ||
end = start + 1 | ||
brackets = 0 | ||
while end <= len(line) and (line[end-1] != "=" or brackets != 0): | ||
if line[end-1] == "(": | ||
brackets += 1 | ||
elif line[end-1] == ")": | ||
brackets -= 1 | ||
end += 1 | ||
instances[-1]["methods"].append(line[0:end] + " undefined") | ||
|
||
# Output findings | ||
with open(outFilePath, "w") as outFile: | ||
outFile.write("") | ||
|
||
with open(outFilePath, "a") as outFile: | ||
for instance in instances: | ||
outFile.write(instance["declaration"]) | ||
for type in instance["types"]: | ||
outFile.write(type + "\n") | ||
for method in instance["methods"]: | ||
outFile.write(method + "\n") | ||
outFile.write("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
book |
Oops, something went wrong.