Skip to content

Commit

Permalink
Merge pull request #44 from SpontanCombust/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SpontanCombust authored Jun 17, 2024
2 parents ecb6894 + d6f3f84 commit d6bdd70
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

***WIDE*** (**W**itcherScript **I**ntegrated **D**evelopment **E**nvironment) is unofficial Witcher 3 modding tooling aimed at improving developer experience by supplying them with powerful code analysis tools in the form of an editor extension making use of a Language Server.

The goal is to have a full set of features that will make [ScriptStudio](https://witcher-games.fandom.com/wiki/Script_Studio) obsolete and reduce the overhead of fixing compilation errors detected when launching the game.
The goal is to provide a full set of features that the [ScriptStudio](https://witcher-games.fandom.com/wiki/Script_Studio) offers and more while at the same time being open-source.

Currently the only supported client is Visual Studio Code.

Expand Down
3 changes: 2 additions & 1 deletion crates/analysis/src/utils/visitors/expr_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ impl SyntaxNodeVisitor for ExpressionEvaluator<'_> {
| BinaryOperator::Sum
| BinaryOperator::Diff
| BinaryOperator::BitAnd
| BinaryOperator::BitOr => left_path,
| BinaryOperator::BitOr
| BinaryOperator::BitXor => left_path,
BinaryOperator::And
| BinaryOperator::Or
| BinaryOperator::Equal
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ encoding_rs_io = "0.1"

[dependencies.tree-sitter-witcherscript]
git = "https://github.com/SpontanCombust/tree-sitter-witcherscript.git"
tag = "v0.10.1"
tag = "v0.11.0"
31 changes: 20 additions & 11 deletions crates/core/src/tokens/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub enum BinaryOperator {
Diff,
BitAnd,
BitOr,
BitXor,
And,
Or,
Equal,
Expand All @@ -79,6 +80,7 @@ impl BinaryOperatorNode<'_> {
"binary_op_and" => BinaryOperator::And,
"binary_op_bitor" => BinaryOperator::BitOr,
"binary_op_bitand" => BinaryOperator::BitAnd,
"binary_op_bitxor" => BinaryOperator::BitXor,
"binary_op_eq" => BinaryOperator::Equal,
"binary_op_neq" => BinaryOperator::NotEqual,
"binary_op_gt" => BinaryOperator::Greater,
Expand Down Expand Up @@ -115,6 +117,7 @@ impl<'script> TryFrom<AnyNode<'script>> for BinaryOperatorNode<'script> {
"binary_op_and" |
"binary_op_bitor" |
"binary_op_bitand" |
"binary_op_bitxor" |
"binary_op_eq" |
"binary_op_neq" |
"binary_op_gt" |
Expand All @@ -138,9 +141,10 @@ pub enum AssignmentOperator {
Direct,
Mult,
Div,
Mod,
Sum,
Diff
Diff,
BitAnd,
BitOr
}

pub type AssignmentOperatorNode<'script> = SyntaxNode<'script, AssignmentOperator>;
Expand All @@ -153,7 +157,8 @@ impl AssignmentOperatorNode<'_> {
"assign_op_diff" => AssignmentOperator::Diff,
"assign_op_mult" => AssignmentOperator::Mult,
"assign_op_div" => AssignmentOperator::Div,
"assign_op_mod" => AssignmentOperator::Mod,
"assign_op_bitand" => AssignmentOperator::BitAnd,
"assign_op_bitor" => AssignmentOperator::BitOr,
_ => panic!("Unknown assignment operator: {} {}", self.tree_node.kind(), self.range().debug())
}
}
Expand All @@ -180,7 +185,8 @@ impl<'script> TryFrom<AnyNode<'script>> for AssignmentOperatorNode<'script> {
"assign_op_diff" |
"assign_op_mult" |
"assign_op_div" |
"assign_op_mod" => Ok(value.into()),
"assign_op_bitand" |
"assign_op_bitor" => Ok(value.into()),
_ => Err(())
}
}
Expand Down Expand Up @@ -254,8 +260,8 @@ impl OperatorTraits for BinaryOperator {
match self {
BinaryOperator::Equal |
BinaryOperator::NotEqual |
BinaryOperator::Lesser |
BinaryOperator::LesserOrEqual |
BinaryOperator::Lesser |
BinaryOperator::LesserOrEqual |
BinaryOperator::Greater |
BinaryOperator::GreaterOrEqual => true,
_ => false
Expand All @@ -267,10 +273,9 @@ impl OperatorTraits for AssignmentOperator {
fn is_arithmetic(&self) -> bool {
match self {
AssignmentOperator::Mult |
AssignmentOperator::Div |
AssignmentOperator::Mod |
AssignmentOperator::Sum |
AssignmentOperator::Diff => true,
AssignmentOperator::Div |
AssignmentOperator::Sum |
AssignmentOperator::Diff => true,
_ => false
}
}
Expand All @@ -280,7 +285,11 @@ impl OperatorTraits for AssignmentOperator {
}

fn is_bitwise(&self) -> bool {
false
match self {
AssignmentOperator::BitAnd |
AssignmentOperator::BitOr => true,
_ => false
}
}

fn is_relational(&self) -> bool {
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

***WIDE*** (**W**itcherScript **I**ntegrated **D**evelopment **E**nvironment) is an unofficial Witcher 3 modding tooling aimed at improving developer experience by supplying them with powerful code analysis tools in the form of an editor extension.

The goal is to provide a full set of features that the [ScriptStudio](https://witcher-games.fandom.com/wiki/Script_Studio) offers and more while at the same time being open-source.

WIDE includes an implementation of [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) for the WitcherScript language - a proprietary scripting language used by award winning game Witcher 3 Wild Hunt created by CD Projekt RED.

Sections:
Expand Down
10 changes: 10 additions & 0 deletions docs/user-manual/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
# Changelog


## v0.3.2
**Hotfix**

### Features
- Added support for XOR binary operator
- Added support for BITAND assignment operator
- Added support for BITOR assignment operator
- Removed support for modulo assignment operator as it is not recognized by the compiler


## v0.3.1
**Annotation support**

Expand Down
10 changes: 10 additions & 0 deletions editors/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
# Changelog


## v0.3.2
**Hotfix**

### Features
- Added support for XOR binary operator
- Added support for BITAND assignment operator
- Added support for BITOR assignment operator
- Removed support for modulo assignment operator as it is not recognized by the compiler


## v0.3.1
**Annotation support**

Expand Down
2 changes: 2 additions & 0 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

***WIDE*** (**W**itcherScript **I**ntegrated **D**evelopment **E**nvironment) is an unofficial Witcher 3 modding tooling aimed at improving developer experience by supplying them with powerful code analysis tools in the form of an editor extension.

The goal is to provide a full set of features that the [ScriptStudio](https://witcher-games.fandom.com/wiki/Script_Studio) offers and more while at the same time being open-source.

This extension provides support for Witcher 3's scripting language WitcherScript.


Expand Down

0 comments on commit d6bdd70

Please sign in to comment.