-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6727229
commit 65a257b
Showing
12 changed files
with
133 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,49 @@ | ||
INSTALL_LOC="/usr/local/bin" | ||
|
||
echo "You are installing the calyx-lsp program" | ||
echo "========================================" | ||
|
||
echo "0. Checks:" | ||
grep -q 'name = "calyx"' ../Cargo.toml 1>/dev/null 2>/dev/null | ||
if [ $? -ne 0 ] ; then | ||
echo " => Please run this install script from the calyx repository ❌" | ||
exit 1 | ||
else | ||
echo " => You are installing this from the calyx repository ✅" | ||
fi | ||
|
||
if which calyx-lsp >/dev/null; then | ||
echo " => calyx-lsp is already installed under $(which calyx-lsp) ❌" | ||
exit 1 | ||
else | ||
echo " => This is a fresh install ✅" | ||
fi | ||
|
||
echo | ||
echo "1. Configure install location:" | ||
echo " => Default: under '$INSTALL_LOC'" | ||
printf " => Are you ok with this? (y/n) " | ||
read answer | ||
if [ "$answer" != "y" ]; then | ||
printf " => Please enter the new install location: " | ||
read INSTALL_LOC | ||
fi | ||
echo | ||
echo "2. Confirm install location:" | ||
printf " => Confirm that you want to install under '$INSTALL_LOC' (y/n) " | ||
read answer | ||
if [ "$answer" != "y" ]; then | ||
echo | ||
echo "Exiting..." | ||
exit 0 | ||
fi | ||
echo | ||
cargo build --manifest-path Cargo.toml || exit 1 | ||
OLD_PWD=`pwd` | ||
cd .. | ||
REPO=`pwd` | ||
cd $INSTALL_LOC | ||
sudo ln -s "$REPO/target/debug/calyx-lsp" calyx-lsp \ | ||
&& echo "Installation was successful!" \ | ||
|| sudo rm -f calyx-lsp | ||
cd $OLD_PWD |
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,14 @@ | ||
use calyx_utils::{CalyxResult, Error}; | ||
|
||
pub fn apply_preprocessor(text: &str) -> CalyxResult<String> { | ||
let mut ctx = preprocessor::Context::new(); | ||
let result = text | ||
.lines() | ||
.map(|line| { | ||
ctx.process(line.into()) | ||
.map_err(|err| Error::misc(err.to_string())) | ||
}) | ||
.collect::<CalyxResult<Vec<_>>>()?; | ||
|
||
Ok(result.join("\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