diff --git a/.cargo/config.toml b/.cargo/config.toml index e6e5441c60..61e413fce5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -14,4 +14,4 @@ rustflags = [ "-C", "link-arg=--target=aarch64-linux-gnu", ] -linker = "clang" \ No newline at end of file +linker = "clang" diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index eee449832f..d10a96e1c0 100755 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -18,7 +18,7 @@ ENV DEBIAN_FRONTEND=noninteractive # # [Optional] Add sudo support for the non-root user # && apt-get install -y sudo \ # && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ -# && chmod 0440 /etc/sudoers.d/$USERNAME +# && chmod 0440 /etc/sudoers.d/$USERNAME RUN apt-get -y update RUN apt-get -y install git diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2afc92f8b8..d2fb67b58f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,43 +1,44 @@ { - "name": "Rust", - "build": { - "dockerfile": "./Dockerfile" - }, - // "image": "ghcr.io/plc-lang/rust-llvm:latest", - "features": { - "ghcr.io/devcontainers/features/common-utils:2": { + "name": "Rust", + "build": { + "dockerfile": "./Dockerfile" + }, + // "image": "ghcr.io/plc-lang/rust-llvm:latest", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "true", "username": "vscode", "userUid": "1000", "userGid": "1000", "upgradePackages": "true" } - }, - // Set *default* container specific settings.json values on container create. - "customizations": { - "vscode": { - "settings": { - "lldb.executable": "/usr/bin/lldb", - // VS Code don't watch files under ./target - "files.watcherExclude": { - "**/target/**": true - }, - "rust-analyzer.checkOnSave.command": "clippy" - }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "bungcip.better-toml", - "vadimcn.vscode-lldb", - "mutantdino.resourcemonitor", - "rust-lang.rust-analyzer" - ] - } - }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "rustc --version", - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "vscode", - "containerUser": "vscode" + }, + // Set *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "lldb.executable": "/usr/bin/lldb", + // VS Code don't watch files under ./target + "files.watcherExclude": { + "**/target/**": true + }, + "rust-analyzer.checkOnSave.command": "clippy" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "bungcip.better-toml", + "editorconfig.editorconfig", + "vadimcn.vscode-lldb", + "mutantdino.resourcemonitor", + "rust-lang.rust-analyzer" + ] + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "rustc --version", + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "containerUser": "vscode" } diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..305b1aa050 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[*.{yaml,yml}] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..76c689bf24 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Set default behaviour to force line endings to LF. +* text=auto eol=lf diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 5c0e2f6476..e8e3c8e901 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -15,8 +15,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Run Documentation Build run: | diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 88bcbac5bb..a4f340e6bb 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v3 - + - name: Update git permissions run: | git config --global --add safe.directory /__w/rusty/rusty diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 80d18bee7e..8f15c55c0c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,14 +10,12 @@ on: workflow_dispatch: jobs: - check: + check: name: Check runs-on: ubuntu-latest container: ghcr.io/plc-lang/rust-llvm:latest steps: - uses: actions/checkout@v3 - with: - submodules: true - name: Run Check run: | @@ -49,7 +47,7 @@ jobs: echo "Build command : ./scripts/build.sh --build --release" ./scripts/build.sh --build --release --package \ --target x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu - + - uses: actions/upload-artifact@master with: name: plc @@ -85,7 +83,7 @@ jobs: with: version: ${{ env.llvm-version }} directory: "./llvm" - + - name: Cargo test (Unit) uses: actions-rs/cargo@v1 with: @@ -109,7 +107,7 @@ jobs: with: command: build args: --release - + - uses: actions/upload-artifact@master with: name: plc.exe @@ -127,7 +125,7 @@ jobs: ./scripts/build.sh --check-style coverage: - name: Run Coverage + name: Run Coverage runs-on: ubuntu-latest container: ghcr.io/plc-lang/rust-llvm:latest steps: @@ -140,7 +138,7 @@ jobs: - name: Upload to codecov.io uses: codecov/codecov-action@v3 with: - files: lcov.info + files: lcov.info - name: Archive code coverage results uses: actions/upload-artifact@v1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000..fb5b5e0737 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,75 @@ +# Pre-commit is currently in testing phase for this repo. It is not yet forced +# in CI or mandatory to use. Pre-commit will run various checks and mostly fix +# those when you do commiting. You can use it locally by installing it with +# +# pip install pre-commit +# +# and running +# +# pre-commit install +# +# in the root of the repository. This will install git hook which will run +# checks before every commit. If you want to run checks manually for whole repo, +# you can run +# +# pre-commit run --all-files +# +# You can always commit without running checks by adding --no-verify flag to git +# commit command. + +exclude: target/|\.git/|.*\.snap + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: c4a0b883114b00d8d76b479c820ce7950211c99b # v4.5.0 + hooks: + - id: check-merge-conflict + args: [--assume-in-merge] + # Editorconfig-checker does not care if file contains multiple newlines. + - id: end-of-file-fixer + - id: check-yaml + - id: check-case-conflict + - id: trailing-whitespace + - id: fix-byte-order-marker + + - repo: https://github.com/Lucas-C/pre-commit-hooks + rev: 762c66ea96843b54b936fc680162ea67f85ec2d7 # v1.5.4 + hooks: + - id: remove-tabs + name: Remove tabs (4 spaces) + args: ['--whitespaces-count', '4'] + exclude: \.(yaml|yml)$ + - id: remove-tabs + name: Remove tabs (2 spaces) + args: ['--whitespaces-count', '2'] + files: \.(yaml|yml)$ + + - repo: https://github.com/pre-commit/pygrep-hooks + rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # v1.10.0 + hooks: + - id: text-unicode-replacement-char + exclude: ".*test_fdx_utf8.cpp$" + + # Formatting Python code. We have not so many files so no example flake8 yet. + - repo: https://github.com/psf/black + rev: 2a1c67e0b2f81df602ec1f6e7aeb030b9709dc7c #23.11.0 + hooks: + - id: black + language_version: python3 + + - repo: https://github.com/doublify/pre-commit-rust + rev: eeee35a89e69d5772bdee97db1a6a898467b686e #v1.0 + hooks: + - id: fmt + - id: cargo-check + - id: clippy + args: ["--", "-D", "warnings"] + + - repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 2b74735540f79457a50369e5c17a2c35d52c3298 # 2.7.3 + hooks: + - id: editorconfig-checker + args: [ + # Saddly we have to disable this, but it just won't work. Maybe some day. + -disable-indent-size, + ] diff --git a/.vscode/launch.json b/.vscode/launch.json index be9b1159d8..bf585bf031 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -46,4 +46,4 @@ "cwd": "${workspaceFolder}" }, ] -} \ No newline at end of file +} diff --git a/Cargo.toml b/Cargo.toml index ebaef5a49e..825edd9492 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,8 +2,8 @@ name = "rusty" version = "0.2.0" authors = [ - "Ghaith Hachem ", - "Mathias Rieder ", + "Ghaith Hachem ", + "Mathias Rieder ", ] edition = "2021" readme = "README.md" @@ -59,16 +59,16 @@ path = "src/lib.rs" [workspace] members = [ - "xtask", - "libs/stdlib", - "compiler/plc_driver", - "compiler/plc_ast", - "compiler/plc_diagnostics", - "compiler/plc_project", - "compiler/plc_source", - "compiler/plc_util", - "compiler/plc_xml", - "compiler/plc_derive", + "xtask", + "libs/stdlib", + "compiler/plc_driver", + "compiler/plc_ast", + "compiler/plc_diagnostics", + "compiler/plc_project", + "compiler/plc_source", + "compiler/plc_util", + "compiler/plc_xml", + "compiler/plc_derive", ] default-members = [".", "compiler/plc_driver", "compiler/plc_xml"] diff --git a/book/iecst.min.js b/book/iecst.min.js index d9a3e36c93..63c0253663 100644 --- a/book/iecst.min.js +++ b/book/iecst.min.js @@ -20,4 +20,4 @@ begin:"[a-zA-Z_]+#\\-?[0-9_]*",relevance:0},{className:"symbol", begin:"%(I|Q|M)(X|B|W|D|L)[0-9\\.]*"},{className:"symbol", begin:"%(I|Q|M)[0-9.]*" },e.C_NUMBER_MODE,e.COMMENT("//","$"),e.C_BLOCK_COMMENT_MODE,e.COMMENT("\\(\\*","\\*\\)")] -})})()); \ No newline at end of file +})})()); diff --git a/book/llvm.min.js b/book/llvm.min.js index d9a279c4c3..280843d531 100644 --- a/book/llvm.min.js +++ b/book/llvm.min.js @@ -16,4 +16,4 @@ variants:[{begin:/"/,end:/[^\\]"/}]},i,{className:"punctuation",relevance:0, begin:/,/},{className:"operator",relevance:0,begin:/=/},t,{className:"symbol", variants:[{begin:/^\s*[a-z]+:/}],relevance:0},{className:"number",variants:[{ begin:/0[xX][a-fA-F0-9]+/},{begin:/-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?/ -}],relevance:0}]}}})();hljs.registerLanguage("llvm",e)})(); \ No newline at end of file +}],relevance:0}]}}})();hljs.registerLanguage("llvm",e)})(); diff --git a/book/src/arch/architecture.md b/book/src/arch/architecture.md index 65db19fd61..225eebda1a 100644 --- a/book/src/arch/architecture.md +++ b/book/src/arch/architecture.md @@ -62,4 +62,4 @@ While a fully fledged compiler generates machine code as a last step, RuSTy gene │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └────────────────┘ └────────────┘ └────────────┘ └────────────┘ └────────────┘ -``` +``` diff --git a/book/src/arch/codegen.md b/book/src/arch/codegen.md index 3315f2e335..56129b3cd4 100644 --- a/book/src/arch/codegen.md +++ b/book/src/arch/codegen.md @@ -126,7 +126,7 @@ Struct types translate direclty to llvm struct datatypes. We generate a new datatype with the user-type's name for the struct. ```iecst -TYPE MyStruct: +TYPE MyStruct: STRUCT a: DINT; b: INT; @@ -162,7 +162,7 @@ For every enum's element we generate a global variable with the element's value. Array types are generated as fixed sized llvm vector types - note that Array types must be fixed sized in *ST* : ```iecst -TYPE MyArray: ARRAY[0..9] OF INT; +TYPE MyArray: ARRAY[0..9] OF INT; END_TYPE VAR_GLOBAL @@ -208,9 +208,9 @@ This means that such a multidimensional array must be initialized like a single- ```iecst VAR_GLOBAL - wrong_array : ARRAY[1..2, 0..3] OF INT := [ [10, 11, 12], - [20, 21, 22], - [30, 31, 32]]; + wrong_array : ARRAY[1..2, 0..3] OF INT := [ [10, 11, 12], + [20, 21, 22], + [30, 31, 32]]; END_VAR ``` @@ -218,9 +218,9 @@ END_VAR ```iecst VAR_GLOBAL - correct_array : ARRAY[1..2, 0..3] OF INT := [ 10, 11, 12, - 20, 21, 22, - 30, 31, 32]; + correct_array : ARRAY[1..2, 0..3] OF INT := [ 10, 11, 12, + 20, 21, 22, + 30, 31, 32]; END_VAR ``` diff --git a/book/src/arch/linker.md b/book/src/arch/linker.md index a9b049066d..c583ca3882 100644 --- a/book/src/arch/linker.md +++ b/book/src/arch/linker.md @@ -3,13 +3,13 @@ The linker's task is to decide where all references in the source code point to. There are different references in Structured Text: -- variable references -`x := 4` where *x* is a reference to the variable x. -- type references +- variable references +`x := 4` where *x* is a reference to the variable x. +- type references `i : MyFunctionBlock` where *MyFunctionBlock* is a reference to the declared FunctionBlock. -- Program references +- Program references `PLC_PRG.x := 4` where *PLC_PRG* is a reference to a Program-POU called *PLC_PRG*. -- Function references +- Function references `max(a, b)` where *max* is a reference to a Function-POU called *max*. So the linker decides where a reference points to. A reference has a corresponding declaration that matches the reference's name: @@ -20,7 +20,7 @@ So the linker decides where a reference points to. A reference has a correspondi ┌──────► x : INT; │ - │ END_VAR + │ END_VAR │ └────┐ │ @@ -58,7 +58,7 @@ So the expression `a + 3` now looks like this: │ ID: 1 │ └──────┬──┬───────┘ │ │ - left │ │ right + left │ │ right ┌───────────┘ └──────────┐ │ │ │ │ @@ -73,7 +73,7 @@ So the expression `a + 3` now looks like this: The AnnotationMap stores 5 different types of annotation: -- `Value` +- `Value` The Value-annotation indicates that this AST-Element resolves to a value with the given resulting datatype. So for Example the LiteralInteger(3) node gets a Value-Annotation with a resulting type of `DINT`. @@ -321,4 +321,3 @@ The code-generation steps can easily decide when to generate casts, by simply co When generating multiple units, the Linker will keep track of a dependency-tree for the unit. This means that every datatype or global variable referenced directly or indirectly by the module will be marked as a dependency. This information can then be used during the [codegen](./codegen.md) period to only generated types and variables that are relevant to the unit. - diff --git a/book/src/arch/parser.md b/book/src/arch/parser.md index aa245a091c..c1da7b5047 100644 --- a/book/src/arch/parser.md +++ b/book/src/arch/parser.md @@ -95,7 +95,7 @@ As the parser reads the token stream `Reference`, `KeywordEquals`, `Number`, `Se ┌─────────────────┐ │ Assignment │ └──────┬──┬───────┘ - left │ │ right + left │ │ right ┌───────────┘ └──────────┐ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ diff --git a/book/src/build_and_install.md b/book/src/build_and_install.md index 7f3e15cfa7..bafef5823c 100644 --- a/book/src/build_and_install.md +++ b/book/src/build_and_install.md @@ -1,7 +1,7 @@ # Build & Install RuSTys code can be found on [GitHub](https://github.com/PLC-lang/rusty). -By default a `Dockerfile` and a `devcontainer.json` file are provided. If you wish to develop natively +By default a `Dockerfile` and a `devcontainer.json` file are provided. If you wish to develop natively however, you will need some additional dependencies namely: - [Rust](https://www.rust-lang.org/tools/install) @@ -12,7 +12,7 @@ however, you will need some additional dependencies namely: The next sections cover how to install these dependencies on different platforms, if you already have them however, RuSTy can be build using the `cargo` command. For debug builds this can be accomplished by executing -`cargo build` and for release builds (smaller & faster) you would execute `cargo build --release`. The +`cargo build` and for release builds (smaller & faster) you would execute `cargo build --release`. The resulting binaries can be found at `target/debug/plc` and `target/release/plc` respectively. ## Ubuntu @@ -24,7 +24,7 @@ sudo apt install \ build-essential \ llvm-14-dev liblld-14-dev \ libz-dev \ - libclang-common-14-dev + libclang-common-14-dev ``` Additionally you _might_ need `libffi7`, which can be installed with `sudo apt install libffi7`. @@ -73,4 +73,4 @@ major version of the `llvm-sys` crate.Currently you will need to install LLVM 14 - To avoid installation conflicts on Linux/Ubuntu, make sure you don't have a default installation available (like you get by just installing `llvm-dev`), which may break things. If you do, make sure you have set the appropriate environment variable (`LLVM_SYS_140_PREFIX=/usr/lib/llvm-14` for LLVM 14), so -the build of the `llvm-sys` crate knows what files to grab. \ No newline at end of file +the build of the `llvm-sys` crate knows what files to grab. diff --git a/book/src/cfc/cfc.md b/book/src/cfc/cfc.md index 6789ab7f65..6540888c72 100644 --- a/book/src/cfc/cfc.md +++ b/book/src/cfc/cfc.md @@ -1,8 +1,8 @@ # CFC (Continous Function Chart) -RuSTy is compatible with CFC, as per the FBD part detailed in the [IEC61131-3 XML-exchange format](https://www.plcopen.org/system/files/downloads/tc6_xml_v201_technical_doc.pdf). -The CFC implementation borrows extensively from the [ST compiler-pipeline](../arch/architecture.md), with the exception that the lexical analysis and parsing phases are replaced by a model-to-model conversion process. -This involves converting the XML into a structured model, which is then converted into ST AST statements. +RuSTy is compatible with CFC, as per the FBD part detailed in the [IEC61131-3 XML-exchange format](https://www.plcopen.org/system/files/downloads/tc6_xml_v201_technical_doc.pdf). +The CFC implementation borrows extensively from the [ST compiler-pipeline](../arch/architecture.md), with the exception that the lexical analysis and parsing phases are replaced by a model-to-model conversion process. +This involves converting the XML into a structured model, which is then converted into ST AST statements. -The next chapter will walk you through the CFC implementation, giving you a better understanding of underlying [code](https://github.com/PLC-lang/rusty/tree/master/compiler/plc_xml). \ No newline at end of file +The next chapter will walk you through the CFC implementation, giving you a better understanding of underlying [code](https://github.com/PLC-lang/rusty/tree/master/compiler/plc_xml). diff --git a/book/src/cfc/m2m.md b/book/src/cfc/m2m.md index 08e52fd0c5..47ad549b6b 100644 --- a/book/src/cfc/m2m.md +++ b/book/src/cfc/m2m.md @@ -21,10 +21,10 @@ Consider the heavily minified CFC file [`MyProgram.cfc`](m2m.md#myprogramcfc), w │ local_id:1 │ │ ref_local_id: 1 │ └─────────────┘ └─────────────────┘ local_id: 2 -``` +``` The initial phase of the transformation process involves streaming the entire input file. -During the streaming process, whenever important keywords such as `block` are encountered, they are directly mapped into a corresponding model structure. +During the streaming process, whenever important keywords such as `block` are encountered, they are directly mapped into a corresponding model structure. For example, when reaching the line `` within the XML file, we generate a model that can be represented as follows: ```rust,ignore struct Block { @@ -44,7 +44,7 @@ This process is repeated for every element in the input file which has a corresp Since the CFC programming language utilizes blocks and their interconnections to establish the program's logic flow, with the sequencing of block execution and inter-block links represented through corresponding `localId`, `refLocalId` and `excutionOrderId`, -we have to order each element by their execution ID before proceeding to the next phase. +we have to order each element by their execution ID before proceeding to the next phase. Otherwise the generated AST statements would be out of order and hence semantically incorrect. ## Data-Model to AST @@ -53,9 +53,9 @@ Consider the previous `block` example - the transformer first encounters the ele We then check and transform each parameter, input `a` and `b` corresponding to the variables `x` and `y` respectively. The result of this transformation looks as follows: ```rust,ignore -CallStatement { - operator: myAdd, - parameters: [x, y] +CallStatement { + operator: myAdd, + parameters: [x, y] } ``` @@ -63,7 +63,7 @@ CallStatement { ```rust,ignore AssignmentStatement { - left: z, + left: z, right: CallStatement { operator: myAdd, parameters: [x, y] diff --git a/book/src/direct_variables.md b/book/src/direct_variables.md index d140e81314..b2027fce59 100644 --- a/book/src/direct_variables.md +++ b/book/src/direct_variables.md @@ -1,79 +1,79 @@ -# Direct (Bit) Access on Variables - -The IEC61131-3 Standard allows reading specific `Bits`, `Bytes`, `Words` or `DWords` from an `ANY_BIT` type. -RuSTy supports this functionalty and extends it to support all `INT` types. - -## Constant based Direct Access - -To access a bit sequence in a variable, a direct access instruction `%` is used. - -`Type` is the bit sequence size required and is described as follows: - -| Type | Size | Example | -| ---- | ---- | ------- | -| X | 1 | `%X1 | -| B | 8 | `%B1 | -| W | 16 | `%W1 | -| D | 32 | `%D1 | - -> _For `Bit` access, the `%X` is optional._ - -### Example - -```st -FUNCTION main : DINT -VAR - variable : LWORD; - bitTarget : BOOL; - bitTarget2 : BOOL; - byteTarget : BYTE; - wordTarget : WORD; - dwordTarget : DWORD; -END_VAR - -variable := 16#AB_CD_EF_12_34_56_78_90; -bitTarget := variable.%X63; (*Access last bit*) -byteTarget := variable.%B7; (*Access last byte*) -wordTarget := variable.%W3; (*Access last word*) -dwordTarget := variable.%D1; (*Access last dword*) -(*Chaining an access is also allowed *) -bitTarget2 := variable.%D1.%W1.%B1.%X1; - -END_FUNCTION -``` - -## Varirable based Direct Access - -While the IEC61131-3 Standard only defines variable access using constant int literals, -RuSTy additionally supports access using Variables. -The Syntax for a variable based access is `%`. -The provided varibale has to be a direct Reference variable (non Qualified). - -> _Short hand access for Bit (Without the `%X` modifier) is not allowed._ - -### Example - -```st -FUNCTION main : DINT -VAR - variable : LWORD; - access_var : INT; - bitTarget : BOOL; - bitTarget2 : BOOL; - byteTarget : BYTE; - wordTarget : WORD; - dwordTarget : DWORD; -END_VAR -variable := 16#AB_CD_EF_12_34_56_78_90; -access_var := 63; -bitTarget := variable.%Xaccess_var; (*Access last bit*) -access_var := 7; -byteTarget := variable.%Baccess_var; (*Access last byte*) -access_var := 3; -wordTarget := variable.%Waccess_var; (*Access last word*) -access_var := 1; -dwordTarget := variable.%Daccess_var; (*Access last dword*) -(*Chaining an access is also allowed *) -bitTarget2 := variable.%Daccess_var.%Waccess_var.%Baccess_var.%Xaccess_var; -END_FUNCTION -``` +# Direct (Bit) Access on Variables + +The IEC61131-3 Standard allows reading specific `Bits`, `Bytes`, `Words` or `DWords` from an `ANY_BIT` type. +RuSTy supports this functionalty and extends it to support all `INT` types. + +## Constant based Direct Access + +To access a bit sequence in a variable, a direct access instruction `%` is used. + +`Type` is the bit sequence size required and is described as follows: + +| Type | Size | Example | +| ---- | ---- | ------- | +| X | 1 | `%X1 | +| B | 8 | `%B1 | +| W | 16 | `%W1 | +| D | 32 | `%D1 | + +> _For `Bit` access, the `%X` is optional._ + +### Example + +```st +FUNCTION main : DINT +VAR + variable : LWORD; + bitTarget : BOOL; + bitTarget2 : BOOL; + byteTarget : BYTE; + wordTarget : WORD; + dwordTarget : DWORD; +END_VAR + +variable := 16#AB_CD_EF_12_34_56_78_90; +bitTarget := variable.%X63; (*Access last bit*) +byteTarget := variable.%B7; (*Access last byte*) +wordTarget := variable.%W3; (*Access last word*) +dwordTarget := variable.%D1; (*Access last dword*) +(*Chaining an access is also allowed *) +bitTarget2 := variable.%D1.%W1.%B1.%X1; + +END_FUNCTION +``` + +## Varirable based Direct Access + +While the IEC61131-3 Standard only defines variable access using constant int literals, +RuSTy additionally supports access using Variables. +The Syntax for a variable based access is `%`. +The provided varibale has to be a direct Reference variable (non Qualified). + +> _Short hand access for Bit (Without the `%X` modifier) is not allowed._ + +### Example + +```st +FUNCTION main : DINT +VAR + variable : LWORD; + access_var : INT; + bitTarget : BOOL; + bitTarget2 : BOOL; + byteTarget : BYTE; + wordTarget : WORD; + dwordTarget : DWORD; +END_VAR +variable := 16#AB_CD_EF_12_34_56_78_90; +access_var := 63; +bitTarget := variable.%Xaccess_var; (*Access last bit*) +access_var := 7; +byteTarget := variable.%Baccess_var; (*Access last byte*) +access_var := 3; +wordTarget := variable.%Waccess_var; (*Access last word*) +access_var := 1; +dwordTarget := variable.%Daccess_var; (*Access last dword*) +(*Chaining an access is also allowed *) +bitTarget2 := variable.%Daccess_var.%Waccess_var.%Baccess_var.%Xaccess_var; +END_FUNCTION +``` diff --git a/book/src/libraries.md b/book/src/libraries.md index 8c2b686df0..285c1ce3bb 100644 --- a/book/src/libraries.md +++ b/book/src/libraries.md @@ -21,7 +21,7 @@ A library is defined by: > PROGRAM example > VAR_INPUT > a,b,c : DINT - > END_VAR + > END_VAR > (* End of interface *) > > (* Implementation *) diff --git a/book/src/libraries/external_functions.md b/book/src/libraries/external_functions.md index 1d7b61c42d..e989d9fbaa 100644 --- a/book/src/libraries/external_functions.md +++ b/book/src/libraries/external_functions.md @@ -96,7 +96,7 @@ An `ST` program called `ExternalFunctions.st` with the following code can be dec (*ExternalFunctions.st*) (** - * The printf function's interface, marked as external since + * The printf function's interface, marked as external since * it is defined directly along other ST functions *) {external} diff --git a/book/src/pous.md b/book/src/pous.md index aa9bd8436c..d923d74fe0 100644 --- a/book/src/pous.md +++ b/book/src/pous.md @@ -10,7 +10,7 @@ It can be defined as either a Program, a Function, a Function Block, or an Actio A POU is defined as: ```iecst - name + name (* parameters *) (* code *) @@ -106,7 +106,7 @@ A program does not support passing input parameters by reference. Example: ```iecst -PROGRAM prg +PROGRAM prg (* parameters *) VAR_INPUT x : INT; diff --git a/book/src/using_rusty.md b/book/src/using_rusty.md index 4699d1130b..7ea9ca0b9a 100644 --- a/book/src/using_rusty.md +++ b/book/src/using_rusty.md @@ -36,7 +36,7 @@ This example is available under `examples/hello_world.st` in the main RuSTy repo - On Windows and MacOS, replace this with `--linker=clang` as cc is usually not available. ```iecst -{external} +{external} FUNCTION puts : DINT VAR_INPUT {ref} text : STRING; @@ -121,4 +121,4 @@ This is determined by the underlying parallelisation library [Rayon](https://cra With the introducton of parallel compilation, every unit is compiled into an object file independently and then linked together in a single module. This behaviour might not always be desired and could be disabled using the `--single-module` flag. -> Note that the single module flag is currently much slower to produce as it requires first generating all modules and then merging them together. \ No newline at end of file +> Note that the single module flag is currently much slower to produce as it requires first generating all modules and then merging them together. diff --git a/compiler/plc_driver/src/cli.rs b/compiler/plc_driver/src/cli.rs index 0a3befef98..9c6676bf68 100644 --- a/compiler/plc_driver/src/cli.rs +++ b/compiler/plc_driver/src/cli.rs @@ -90,7 +90,7 @@ pub struct CompileParameters { name = "hardware-conf", long, global = true, - help = "Generate Hardware configuration files to the given location. + help = "Generate Hardware configuration files to the given location. Format is detected by extenstion. Supported formats : json, toml", parse(try_from_str = validate_config) diff --git a/compiler/plc_driver/src/tests/external_files.rs b/compiler/plc_driver/src/tests/external_files.rs index 5e11eb04d5..82634939ee 100644 --- a/compiler/plc_driver/src/tests/external_files.rs +++ b/compiler/plc_driver/src/tests/external_files.rs @@ -10,7 +10,7 @@ fn external_file_function_call() { let prog = SourceCode::new( " FUNCTION main : INT - external(); + external(); END_FUNCTION ", "main.st", @@ -19,7 +19,7 @@ fn external_file_function_call() { let ext = SourceCode::new( " FUNCTION external : INT - END_FUNCTION + END_FUNCTION ", "external.st", ); @@ -37,7 +37,7 @@ fn external_file_global_var() { FUNCTION main : INT x := 2; y := 2; - external(); + external(); END_FUNCTION ", "main.st", @@ -49,7 +49,7 @@ fn external_file_global_var() { x : INT; END_VAR FUNCTION external : INT - END_FUNCTION + END_FUNCTION VAR_GLOBAL y : INT; END_VAR @@ -68,7 +68,7 @@ fn calling_external_file_function_without_including_file_results_in_error() { let prog = SourceCode::new( " FUNCTION main : INT - external(); + external(); END_FUNCTION ", "external_file.st", @@ -81,7 +81,7 @@ fn calling_external_file_function_without_including_file_results_in_error() { assert_eq!( Diagnostic::codegen_error( r#"cannot generate call statement for "ReferenceExpr { kind: Member(Identifier { name: \"external\" }), base: None }""#, - source_location_factory.create_range(30..38) + source_location_factory.create_range(33..41) ), msg ) diff --git a/compiler/plc_project/schema/plc-json.schema b/compiler/plc_project/schema/plc-json.schema index a4f4ceb791..19dc9d9335 100644 --- a/compiler/plc_project/schema/plc-json.schema +++ b/compiler/plc_project/schema/plc-json.schema @@ -68,10 +68,10 @@ } } }, - "additionalProperties": false, + "additionalProperties": false, "required": [ "name", "files", "compile_type" ] - } \ No newline at end of file + } diff --git a/compiler/plc_xml/README.md b/compiler/plc_xml/README.md index e89baa6bcc..b43da59d3a 100644 --- a/compiler/plc_xml/README.md +++ b/compiler/plc_xml/README.md @@ -1,3 +1,3 @@ # plc_xml -This crate contains the CFC implementation of RuSTy, for more information refer to the [book](https://plc-lang.github.io/rusty/cfc/cfc.html). \ No newline at end of file +This crate contains the CFC implementation of RuSTy, for more information refer to the [book](https://plc-lang.github.io/rusty/cfc/cfc.html). diff --git a/compiler/plc_xml/src/model/action.rs b/compiler/plc_xml/src/model/action.rs index 224bf725d9..85887efb28 100644 --- a/compiler/plc_xml/src/model/action.rs +++ b/compiler/plc_xml/src/model/action.rs @@ -88,9 +88,9 @@ mod tests { PROGRAM program_0 VAR - a : DINT; + a : DINT; END_VAR - + diff --git a/compiler/plc_xml/src/model/snapshots/plc_xml__model__action__tests__list_of_actions_parsed_to_model.snap b/compiler/plc_xml/src/model/snapshots/plc_xml__model__action__tests__list_of_actions_parsed_to_model.snap index 8544471df2..40e525f614 100644 --- a/compiler/plc_xml/src/model/snapshots/plc_xml__model__action__tests__list_of_actions_parsed_to_model.snap +++ b/compiler/plc_xml/src/model/snapshots/plc_xml__model__action__tests__list_of_actions_parsed_to_model.snap @@ -76,7 +76,7 @@ Project { Interface { add_data: Some( Data { - content: "PROGRAM program_0\nVAR\n\ta : DINT;\nEND_VAR\nEND_PROGRAM", + content: "PROGRAM program_0\nVAR\n a : DINT;\nEND_VAR\nEND_PROGRAM", handle: Implementation, }, ), diff --git a/compiler/plc_xml/src/xml_parser/tests.rs b/compiler/plc_xml/src/xml_parser/tests.rs index a142359318..dbeda9ea1d 100644 --- a/compiler/plc_xml/src/xml_parser/tests.rs +++ b/compiler/plc_xml/src/xml_parser/tests.rs @@ -518,7 +518,7 @@ mod content { PROGRAM program_0 VAR - a,b : DINT; + a,b : DINT; END_VAR diff --git a/examples/ExternalFunctions.st b/examples/ExternalFunctions.st index d9675433a8..505d5b4b7a 100644 --- a/examples/ExternalFunctions.st +++ b/examples/ExternalFunctions.st @@ -13,6 +13,6 @@ END_FUNCTION FUNCTION main : DINT - main := LOG(100); - PRINTF('Log value %d\n', main); + main := LOG(100); + PRINTF('Log value %d\n', main); END_FUNCTION diff --git a/examples/actions.st b/examples/actions.st index f7236f3f2d..c5e9fa9b97 100644 --- a/examples/actions.st +++ b/examples/actions.st @@ -1,6 +1,6 @@ PROGRAM main VAR - a,b : DINT; + a,b : DINT; END_VAr action1(); @@ -9,10 +9,10 @@ action2(); END_PROGRAM ACTIONS - ACTION action1 - a := a + 1; - END_ACTION - ACTION action2 - b := b + 2; - END_ACTION + ACTION action1 + a := a + 1; + END_ACTION + ACTION action2 + b := b + 2; + END_ACTION END_ACTIONS diff --git a/examples/class_method.st b/examples/class_method.st index f89d2e6fa3..1e54f7b646 100644 --- a/examples/class_method.st +++ b/examples/class_method.st @@ -9,4 +9,4 @@ CLASS MyClass x := myMethodArg; END_METHOD -END_CLASS \ No newline at end of file +END_CLASS diff --git a/examples/function_with_return.st b/examples/function_with_return.st index e1304b1500..704c3df57b 100644 --- a/examples/function_with_return.st +++ b/examples/function_with_return.st @@ -1,11 +1,11 @@ FUNCTION smaller_than_ten: BOOL - VAR_INPUT - n : INT; - END_VAR + VAR_INPUT + n : INT; + END_VAR - IF n < 10 THEN - smaller_than_ten := TRUE; - RETURN; - END_IF; - smaller_than_ten := FALSE; + IF n < 10 THEN + smaller_than_ten := TRUE; + RETURN; + END_IF; + smaller_than_ten := FALSE; END_FUNCTION diff --git a/examples/hello_world.st b/examples/hello_world.st index 3ca0c54829..499254ab4e 100644 --- a/examples/hello_world.st +++ b/examples/hello_world.st @@ -1,4 +1,4 @@ -{external} +{external} FUNCTION puts : DINT VAR_INPUT {ref} text : STRING; @@ -6,5 +6,5 @@ END_VAR END_FUNCTION FUNCTION main : DINT - puts('hello, world!$N'); + puts('hello, world!$N'); END_FUNCTION diff --git a/examples/lt.st b/examples/lt.st index edd139c6d3..702a439481 100644 --- a/examples/lt.st +++ b/examples/lt.st @@ -10,5 +10,5 @@ FUNCTION a : DINT END_FUNCTION y^.1 := 3; z^[0] := 4; z^[1].1 := 5; - a() := 5; + a() := 5; END_PROGRAM diff --git a/examples/math_st.c b/examples/math_st.c index 967d6c7ebc..33da8d37e5 100644 --- a/examples/math_st.c +++ b/examples/math_st.c @@ -20,8 +20,3 @@ int LOG(LOG_interface* param) { int PRINTF(PRINT_interface* param) { return printf(param->text, param->value); } - - - - - diff --git a/examples/plc.json b/examples/plc.json index 1e51738091..d0bc582014 100644 --- a/examples/plc.json +++ b/examples/plc.json @@ -1,5 +1,5 @@ { - "name": "ProjectName", + "name": "ProjectName", "files" : [ "examples/hw.st", "examples/hello_world.st", diff --git a/examples/pointer.st b/examples/pointer.st index 32de0b1583..731b599b9e 100644 --- a/examples/pointer.st +++ b/examples/pointer.st @@ -1,17 +1,17 @@ TYPE MyStruct: STRUCT x: DINT; y: DINT; END_STRUCT END_TYPE FUNCTION main : DINT - main := foo(); + main := foo(); END_FUNCTION FUNCTION foo : DINT VAR - x : DINT; - s : MyStruct; - u,y : REF_TO DINT; - z : REF_TO REF_TO DINT; - + x : DINT; + s : MyStruct; + u,y : REF_TO DINT; + z : REF_TO REF_TO DINT; END_VAR + u := NULL; u := &s.x; y := u; diff --git a/examples/program_with_references.st b/examples/program_with_references.st index d7a250fcfc..13b1048df5 100644 --- a/examples/program_with_references.st +++ b/examples/program_with_references.st @@ -1 +1 @@ -PROGRAM exp a AND NOT b OR c XOR d; END_PROGRAM \ No newline at end of file +PROGRAM exp a AND NOT b OR c XOR d; END_PROGRAM diff --git a/examples/program_with_variable_and_operation.st b/examples/program_with_variable_and_operation.st index 3b9c4b9a8e..6583eaa24e 100644 --- a/examples/program_with_variable_and_operation.st +++ b/examples/program_with_variable_and_operation.st @@ -7,9 +7,9 @@ END_VAR IF Condition THEN - -ELSIF - + +ELSIF + END_IF; 1 + 2 + 3 + 4; diff --git a/examples/simple_program.st b/examples/simple_program.st index 3f89442478..0514e1ae3a 100644 --- a/examples/simple_program.st +++ b/examples/simple_program.st @@ -1,8 +1,9 @@ PROGRAM prg VAR - a : INT; - b : REAL; + a : INT; + b : REAL; END_VAR - b := 1.5; - a := b; + + b := 1.5; + a := b; END_PROGRAM diff --git a/libs/stdlib/.gitignore b/libs/stdlib/.gitignore index d11b59f723..a9fe45999f 100644 --- a/libs/stdlib/.gitignore +++ b/libs/stdlib/.gitignore @@ -8,4 +8,4 @@ *.o *.bc *.a -*.elf \ No newline at end of file +*.elf diff --git a/libs/stdlib/iec61131-st/arithmetic_functions.st b/libs/stdlib/iec61131-st/arithmetic_functions.st index 2df8690586..10a512bce6 100644 --- a/libs/stdlib/iec61131-st/arithmetic_functions.st +++ b/libs/stdlib/iec61131-st/arithmetic_functions.st @@ -2,21 +2,21 @@ {external} VAR_GLOBAL - PI_REAL : REAL; - PI_LREAL : LREAL; - FRAC_PI_2_REAL : REAL; - FRAC_PI_2_LREAL : LREAL; - FRAC_PI_4_REAL : REAL; - FRAC_PI_4_LREAL : LREAL; - E_REAL : REAL; - E_LREAL : LREAL; + PI_REAL : REAL; + PI_LREAL : LREAL; + FRAC_PI_2_REAL : REAL; + FRAC_PI_2_LREAL : LREAL; + FRAC_PI_4_REAL : REAL; + FRAC_PI_4_LREAL : LREAL; + E_REAL : REAL; + E_LREAL : LREAL; END_VAR (* Calculates the square root of a given value *) {external} FUNCTION SQRT : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -27,7 +27,7 @@ END_FUNCTION {external} FUNCTION LN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -36,7 +36,7 @@ END_FUNCTION {external} FUNCTION LOG : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -44,7 +44,7 @@ END_FUNCTION {external} FUNCTION EXP : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -55,7 +55,7 @@ END_FUNCTION {external} FUNCTION SIN : T VAR_INPUT - rad : T; + rad : T; END_VAR END_FUNCTION @@ -63,7 +63,7 @@ END_FUNCTION {external} FUNCTION COS : T VAR_INPUT - rad : T; + rad : T; END_VAR END_FUNCTION @@ -71,7 +71,7 @@ END_FUNCTION {external} FUNCTION TAN : T VAR_INPUT - rad : T; + rad : T; END_VAR END_FUNCTION @@ -79,7 +79,7 @@ END_FUNCTION {external} FUNCTION ASIN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -87,7 +87,7 @@ END_FUNCTION {external} FUNCTION ACOS : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -95,7 +95,7 @@ END_FUNCTION {external} FUNCTION ATAN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -103,32 +103,32 @@ END_FUNCTION {external} FUNCTION ATAN2 : T VAR_INPUT - y : T; - x : T; + y : T; + x : T; END_VAR END_FUNCTION {external} FUNCTION EXPT : T -VAR_INPUT - in1 : T; - in2 : U; -END_VAR +VAR_INPUT + in1 : T; + in2 : U; +END_VAR END_FUNCTION {external} FUNCTION EXPT__REAL__DINT : REAL -VAR_INPUT - in1 : REAL; - in2 : DINT; +VAR_INPUT + in1 : REAL; + in2 : DINT; END_VAR END_FUNCTION {external} FUNCTION EXPT__REAL__REAL : REAL -VAR_INPUT - in1 : REAL; - in2 : REAL; +VAR_INPUT + in1 : REAL; + in2 : REAL; END_VAR END_FUNCTION @@ -137,144 +137,144 @@ END_FUNCTION On overflow, infinity of the same sign as the input is produced *) {external} FUNCTION EXPT__REAL__LREAL : REAL -VAR_INPUT - in1 : REAL; - in2 : LREAL; +VAR_INPUT + in1 : REAL; + in2 : LREAL; END_VAR END_FUNCTION {external} FUNCTION EXPT__LREAL__DINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : DINT; +VAR_INPUT + in1 : LREAL; + in2 : DINT; END_VAR END_FUNCTION {external} FUNCTION EXPT__LREAL__REAL : LREAL -VAR_INPUT - in1 : LREAL; - in2 : REAL; +VAR_INPUT + in1 : LREAL; + in2 : REAL; END_VAR END_FUNCTION {external} FUNCTION EXPT__LREAL__LREAL : LREAL -VAR_INPUT - in1 : LREAL; - in2 : LREAL; +VAR_INPUT + in1 : LREAL; + in2 : LREAL; END_VAR END_FUNCTION FUNCTION EXPT__REAL__USINT : REAL -VAR_INPUT - in1 : REAL; - in2 : USINT; +VAR_INPUT + in1 : REAL; + in2 : USINT; END_VAR EXPT__REAL__USINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__UINT : REAL -VAR_INPUT - in1 : REAL; - in2 : UINT; +VAR_INPUT + in1 : REAL; + in2 : UINT; END_VAR EXPT__REAL__UINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__UDINT : REAL -VAR_INPUT - in1 : REAL; - in2 : UDINT; +VAR_INPUT + in1 : REAL; + in2 : UDINT; END_VAR EXPT__REAL__UDINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__ULINT : REAL -VAR_INPUT - in1 : REAL; - in2 : ULINT; +VAR_INPUT + in1 : REAL; + in2 : ULINT; END_VAR EXPT__REAL__ULINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__SINT : REAL -VAR_INPUT - in1 : REAL; - in2 : SINT; +VAR_INPUT + in1 : REAL; + in2 : SINT; END_VAR EXPT__REAL__SINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__INT : REAL -VAR_INPUT - in1 : REAL; - in2 : INT; +VAR_INPUT + in1 : REAL; + in2 : INT; END_VAR EXPT__REAL__INT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__LINT : REAL -VAR_INPUT - in1 : REAL; - in2 : LINT; +VAR_INPUT + in1 : REAL; + in2 : LINT; END_VAR EXPT__REAL__LINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__USINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : USINT; +VAR_INPUT + in1 : LREAL; + in2 : USINT; END_VAR EXPT__LREAL__USINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__UINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : UINT; +VAR_INPUT + in1 : LREAL; + in2 : UINT; END_VAR EXPT__LREAL__UINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__UDINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : UDINT; +VAR_INPUT + in1 : LREAL; + in2 : UDINT; END_VAR EXPT__LREAL__UDINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__ULINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : ULINT; +VAR_INPUT + in1 : LREAL; + in2 : ULINT; END_VAR EXPT__LREAL__ULINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__SINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : SINT; +VAR_INPUT + in1 : LREAL; + in2 : SINT; END_VAR EXPT__LREAL__SINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__INT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : INT; +VAR_INPUT + in1 : LREAL; + in2 : INT; END_VAR EXPT__LREAL__INT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__LINT : LREAL -VAR_INPUT - in1 : LREAL; - in2 : LINT; +VAR_INPUT + in1 : LREAL; + in2 : LINT; END_VAR EXPT__LREAL__LINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION diff --git a/libs/stdlib/iec61131-st/bistable_functionblocks.st b/libs/stdlib/iec61131-st/bistable_functionblocks.st index aabb68bb3e..b4c6983431 100644 --- a/libs/stdlib/iec61131-st/bistable_functionblocks.st +++ b/libs/stdlib/iec61131-st/bistable_functionblocks.st @@ -10,11 +10,11 @@ Return: Output is used as return {external} FUNCTION_BLOCK SR VAR_INPUT - SET1: BOOL; - RESET: BOOL; + SET1: BOOL; + RESET: BOOL; END_VAR VAR_OUTPUT - Q1: BOOL; + Q1: BOOL; END_VAR END_FUNCTION_BLOCK @@ -30,10 +30,10 @@ Return: Output is used as return {external} FUNCTION_BLOCK RS VAR_INPUT - SET: BOOL; - RESET1: BOOL; + SET: BOOL; + RESET1: BOOL; END_VAR VAR_OUTPUT - Q1: BOOL; + Q1: BOOL; END_VAR -END_FUNCTION_BLOCK \ No newline at end of file +END_FUNCTION_BLOCK diff --git a/libs/stdlib/iec61131-st/bit_conversion.st b/libs/stdlib/iec61131-st/bit_conversion.st index 52fd86cd3d..4a3a9ee1f9 100644 --- a/libs/stdlib/iec61131-st/bit_conversion.st +++ b/libs/stdlib/iec61131-st/bit_conversion.st @@ -5,9 +5,9 @@ *********************) FUNCTION LWORD_TO_DWORD : DWORD VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_DWORD := in; + LWORD_TO_DWORD := in; END_FUNCTION (******************** @@ -17,9 +17,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_WORD : WORD VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_WORD := in; + LWORD_TO_WORD := in; END_FUNCTION (******************** @@ -29,9 +29,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_BYTE : BYTE VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_BYTE := in; + LWORD_TO_BYTE := in; END_FUNCTION (******************** @@ -41,9 +41,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_BOOL : BOOL VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_BOOL := in.0; + LWORD_TO_BOOL := in.0; END_FUNCTION (******************** @@ -53,9 +53,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_LWORD : LWORD VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_LWORD := in; + DWORD_TO_LWORD := in; END_FUNCTION (******************** @@ -65,9 +65,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_WORD : WORD VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_WORD := in; + DWORD_TO_WORD := in; END_FUNCTION (******************** @@ -77,9 +77,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_BYTE : BYTE VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_BYTE := in; + DWORD_TO_BYTE := in; END_FUNCTION (******************** @@ -89,9 +89,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_BOOL : BOOL VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_BOOL := in.0; + DWORD_TO_BOOL := in.0; END_FUNCTION (******************** @@ -101,9 +101,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_LWORD : LWORD VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_LWORD := in; + WORD_TO_LWORD := in; END_FUNCTION (******************** @@ -113,9 +113,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_DWORD : DWORD VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_DWORD := in; + WORD_TO_DWORD := in; END_FUNCTION (******************** @@ -125,9 +125,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_BYTE : BYTE VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_BYTE := in; + WORD_TO_BYTE := in; END_FUNCTION (******************** @@ -137,9 +137,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_BOOL : BOOL VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_BOOL := in.0; + WORD_TO_BOOL := in.0; END_FUNCTION (******************** @@ -149,9 +149,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_LWORD : LWORD VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_LWORD := in; + BYTE_TO_LWORD := in; END_FUNCTION (******************** @@ -161,9 +161,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_DWORD : DWORD VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_DWORD := in; + BYTE_TO_DWORD := in; END_FUNCTION (******************** @@ -173,9 +173,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_WORD : WORD VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_WORD := in; + BYTE_TO_WORD := in; END_FUNCTION (******************** @@ -185,9 +185,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_BOOL : BOOL VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_BOOL := in.0; + BYTE_TO_BOOL := in.0; END_FUNCTION (******************** @@ -197,13 +197,13 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_CHAR : CHAR VAR_INPUT - in : BYTE; + in : BYTE; END_VAR VAR - ptr : REF_TO CHAR; + ptr : REF_TO CHAR; END_VAR - ptr := ∈ - BYTE_TO_CHAR := ptr^; + ptr := ∈ + BYTE_TO_CHAR := ptr^; END_FUNCTION (******************** @@ -213,13 +213,13 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_LWORD : LWORD VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_LWORD := 1; - ELSE - BOOL_TO_LWORD := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_LWORD := 1; + ELSE + BOOL_TO_LWORD := 0; + END_IF; END_FUNCTION (******************** @@ -229,13 +229,13 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_DWORD : DWORD VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_DWORD := 1; - ELSE - BOOL_TO_DWORD := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_DWORD := 1; + ELSE + BOOL_TO_DWORD := 0; + END_IF; END_FUNCTION (******************** @@ -245,13 +245,13 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_WORD : WORD VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_WORD := 1; - ELSE - BOOL_TO_WORD := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_WORD := 1; + ELSE + BOOL_TO_WORD := 0; + END_IF; END_FUNCTION (******************** @@ -261,13 +261,13 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_BYTE : BYTE VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_BYTE := 1; - ELSE - BOOL_TO_BYTE := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_BYTE := 1; + ELSE + BOOL_TO_BYTE := 0; + END_IF; END_FUNCTION (******************** @@ -277,13 +277,13 @@ END_FUNCTION *********************) FUNCTION CHAR_TO_BYTE : BYTE VAR_INPUT - in : CHAR; + in : CHAR; END_VAR VAR - ptr : REF_TO BYTE; + ptr : REF_TO BYTE; END_VAR - ptr := ∈ - CHAR_TO_BYTE := ptr^; + ptr := ∈ + CHAR_TO_BYTE := ptr^; END_FUNCTION (******************** @@ -293,9 +293,9 @@ END_FUNCTION *********************) FUNCTION CHAR_TO_WORD : WORD VAR_INPUT - in : CHAR; + in : CHAR; END_VAR - CHAR_TO_WORD := CHAR_TO_BYTE(in); + CHAR_TO_WORD := CHAR_TO_BYTE(in); END_FUNCTION (******************** @@ -305,9 +305,9 @@ END_FUNCTION *********************) FUNCTION CHAR_TO_DWORD : DWORD VAR_INPUT - in : CHAR; + in : CHAR; END_VAR - CHAR_TO_DWORD := CHAR_TO_BYTE(in); + CHAR_TO_DWORD := CHAR_TO_BYTE(in); END_FUNCTION (******************** @@ -317,9 +317,9 @@ END_FUNCTION *********************) FUNCTION CHAR_TO_LWORD : LWORD VAR_INPUT - in : CHAR; + in : CHAR; END_VAR - CHAR_TO_LWORD := CHAR_TO_BYTE(in); + CHAR_TO_LWORD := CHAR_TO_BYTE(in); END_FUNCTION (******************** @@ -329,13 +329,13 @@ END_FUNCTION *********************) FUNCTION WCHAR_TO_WORD : WORD VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR VAR - ptr : REF_TO WORD; + ptr : REF_TO WORD; END_VAR - ptr := ∈ - WCHAR_TO_WORD := ptr^; + ptr := ∈ + WCHAR_TO_WORD := ptr^; END_FUNCTION (******************** @@ -345,9 +345,9 @@ END_FUNCTION *********************) FUNCTION WCHAR_TO_DWORD : DWORD VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR - WCHAR_TO_DWORD := WCHAR_TO_WORD(in); + WCHAR_TO_DWORD := WCHAR_TO_WORD(in); END_FUNCTION (******************** @@ -357,7 +357,7 @@ END_FUNCTION *********************) FUNCTION WCHAR_TO_LWORD : LWORD VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR - WCHAR_TO_LWORD := WCHAR_TO_WORD(in); -END_FUNCTION \ No newline at end of file + WCHAR_TO_LWORD := WCHAR_TO_WORD(in); +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/bit_num_conversion.st b/libs/stdlib/iec61131-st/bit_num_conversion.st index 922c38ca9c..ff0f83ceee 100644 --- a/libs/stdlib/iec61131-st/bit_num_conversion.st +++ b/libs/stdlib/iec61131-st/bit_num_conversion.st @@ -6,7 +6,7 @@ {external} FUNCTION LWORD_TO_LREAL : LREAL VAR_INPUT - in : LWORD; + in : LWORD; END_VAR END_FUNCTION @@ -17,9 +17,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_LINT : LINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_LINT := in; + LWORD_TO_LINT := in; END_FUNCTION (******************** @@ -29,9 +29,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_DINT : DINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_DINT := in; + LWORD_TO_DINT := in; END_FUNCTION (******************** @@ -41,9 +41,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_INT : INT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_INT := in; + LWORD_TO_INT := in; END_FUNCTION (******************** @@ -53,9 +53,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_SINT : SINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_SINT := in; + LWORD_TO_SINT := in; END_FUNCTION (******************** @@ -65,9 +65,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_ULINT : ULINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_ULINT := in; + LWORD_TO_ULINT := in; END_FUNCTION (******************** @@ -77,9 +77,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_UDINT : UDINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_UDINT := in; + LWORD_TO_UDINT := in; END_FUNCTION (******************** @@ -89,9 +89,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_UINT : UINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_UINT := in; + LWORD_TO_UINT := in; END_FUNCTION (******************** @@ -101,9 +101,9 @@ END_FUNCTION *********************) FUNCTION LWORD_TO_USINT : USINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_USINT := in; + LWORD_TO_USINT := in; END_FUNCTION (******************** @@ -114,7 +114,7 @@ END_FUNCTION {external} FUNCTION DWORD_TO_REAL : REAL VAR_INPUT - in : DWORD; + in : DWORD; END_VAR END_FUNCTION @@ -125,9 +125,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_LINT : LINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_LINT := in; + DWORD_TO_LINT := in; END_FUNCTION (******************** @@ -137,9 +137,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_DINT : DINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_DINT := in; + DWORD_TO_DINT := in; END_FUNCTION (******************** @@ -149,9 +149,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_INT : INT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_INT := in; + DWORD_TO_INT := in; END_FUNCTION (******************** @@ -161,9 +161,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_SINT : SINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_SINT := in; + DWORD_TO_SINT := in; END_FUNCTION (******************** @@ -173,9 +173,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_ULINT : ULINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_ULINT := in; + DWORD_TO_ULINT := in; END_FUNCTION (******************** @@ -185,9 +185,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_UDINT : UDINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_UDINT := in; + DWORD_TO_UDINT := in; END_FUNCTION (******************** @@ -197,9 +197,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_UINT : UINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_UINT := in; + DWORD_TO_UINT := in; END_FUNCTION (******************** @@ -209,9 +209,9 @@ END_FUNCTION *********************) FUNCTION DWORD_TO_USINT : USINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_USINT := in; + DWORD_TO_USINT := in; END_FUNCTION (******************** @@ -221,9 +221,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_LINT : LINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_LINT := in; + WORD_TO_LINT := in; END_FUNCTION (******************** @@ -233,9 +233,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_DINT : DINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_DINT := in; + WORD_TO_DINT := in; END_FUNCTION (******************** @@ -245,9 +245,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_INT : INT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_INT := in; + WORD_TO_INT := in; END_FUNCTION (******************** @@ -257,9 +257,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_SINT : SINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_SINT := in; + WORD_TO_SINT := in; END_FUNCTION (******************** @@ -269,9 +269,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_ULINT : ULINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_ULINT := in; + WORD_TO_ULINT := in; END_FUNCTION (******************** @@ -281,9 +281,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_UDINT : UDINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_UDINT := in; + WORD_TO_UDINT := in; END_FUNCTION (******************** @@ -293,9 +293,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_UINT : UINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_UINT := in; + WORD_TO_UINT := in; END_FUNCTION (******************** @@ -305,9 +305,9 @@ END_FUNCTION *********************) FUNCTION WORD_TO_USINT : USINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_USINT := in; + WORD_TO_USINT := in; END_FUNCTION (******************** @@ -317,9 +317,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_LINT : LINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_LINT := in; + BYTE_TO_LINT := in; END_FUNCTION (******************** @@ -329,9 +329,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_DINT : DINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_DINT := in; + BYTE_TO_DINT := in; END_FUNCTION (******************** @@ -341,9 +341,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_INT : INT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_INT := in; + BYTE_TO_INT := in; END_FUNCTION (******************** @@ -353,9 +353,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_SINT : SINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_SINT := in; + BYTE_TO_SINT := in; END_FUNCTION (******************** @@ -365,9 +365,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_ULINT : ULINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_ULINT := in; + BYTE_TO_ULINT := in; END_FUNCTION (******************** @@ -377,9 +377,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_UDINT : UDINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_UDINT := in; + BYTE_TO_UDINT := in; END_FUNCTION (******************** @@ -389,9 +389,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_UINT : UINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_UINT := in; + BYTE_TO_UINT := in; END_FUNCTION (******************** @@ -401,9 +401,9 @@ END_FUNCTION *********************) FUNCTION BYTE_TO_USINT : USINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_USINT := in; + BYTE_TO_USINT := in; END_FUNCTION (******************** @@ -413,9 +413,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_LINT : LINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_LINT := in; + BOOL_TO_LINT := in; END_FUNCTION (******************** @@ -425,9 +425,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_DINT : DINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_DINT := in; + BOOL_TO_DINT := in; END_FUNCTION (******************** @@ -437,9 +437,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_INT : INT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_INT := in; + BOOL_TO_INT := in; END_FUNCTION (******************** @@ -449,9 +449,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_SINT : SINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_SINT := in; + BOOL_TO_SINT := in; END_FUNCTION (******************** @@ -461,9 +461,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_ULINT : ULINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_ULINT := in; + BOOL_TO_ULINT := in; END_FUNCTION (******************** @@ -473,9 +473,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_UDINT : UDINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_UDINT := in; + BOOL_TO_UDINT := in; END_FUNCTION (******************** @@ -485,9 +485,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_UINT : UINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_UINT := in; + BOOL_TO_UINT := in; END_FUNCTION (******************** @@ -497,9 +497,9 @@ END_FUNCTION *********************) FUNCTION BOOL_TO_USINT : USINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_USINT := in; + BOOL_TO_USINT := in; END_FUNCTION (******************** @@ -510,7 +510,7 @@ END_FUNCTION {external} FUNCTION LREAL_TO_LWORD : LWORD VAR_INPUT - in : LREAL; + in : LREAL; END_VAR END_FUNCTION @@ -522,7 +522,7 @@ END_FUNCTION {external} FUNCTION REAL_TO_DWORD : DWORD VAR_INPUT - in : REAL; + in : REAL; END_VAR END_FUNCTION @@ -533,9 +533,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_LWORD : LWORD VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_LWORD := in; + LINT_TO_LWORD := in; END_FUNCTION (******************** @@ -545,9 +545,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_DWORD : DWORD VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_DWORD := in; + LINT_TO_DWORD := in; END_FUNCTION (******************** @@ -557,9 +557,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_WORD : WORD VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_WORD := in; + LINT_TO_WORD := in; END_FUNCTION (******************** @@ -569,9 +569,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_BYTE : BYTE VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_BYTE := in; + LINT_TO_BYTE := in; END_FUNCTION (******************** @@ -581,9 +581,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_LWORD : LWORD VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_LWORD := in; + DINT_TO_LWORD := in; END_FUNCTION (******************** @@ -593,9 +593,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_DWORD : DWORD VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_DWORD := in; + DINT_TO_DWORD := in; END_FUNCTION (******************** @@ -605,9 +605,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_WORD : WORD VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_WORD := in; + DINT_TO_WORD := in; END_FUNCTION (******************** @@ -617,9 +617,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_BYTE : BYTE VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_BYTE := in; + DINT_TO_BYTE := in; END_FUNCTION (******************** @@ -629,9 +629,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_LWORD : LWORD VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_LWORD := in; + INT_TO_LWORD := in; END_FUNCTION (******************** @@ -641,9 +641,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_DWORD : DWORD VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_DWORD := in; + INT_TO_DWORD := in; END_FUNCTION (******************** @@ -653,9 +653,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_WORD : WORD VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_WORD := in; + INT_TO_WORD := in; END_FUNCTION (******************** @@ -665,9 +665,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_BYTE : BYTE VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_BYTE := in; + INT_TO_BYTE := in; END_FUNCTION (******************** @@ -677,9 +677,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_LWORD : LWORD VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_LWORD := in; + SINT_TO_LWORD := in; END_FUNCTION (******************** @@ -689,9 +689,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_DWORD : DWORD VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_DWORD := in; + SINT_TO_DWORD := in; END_FUNCTION (******************** @@ -701,9 +701,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_WORD : WORD VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_WORD := in; + SINT_TO_WORD := in; END_FUNCTION (******************** @@ -713,9 +713,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_BYTE : BYTE VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_BYTE := in; + SINT_TO_BYTE := in; END_FUNCTION (******************** @@ -725,9 +725,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_LWORD : LWORD VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_LWORD := in; + ULINT_TO_LWORD := in; END_FUNCTION (******************** @@ -737,9 +737,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_DWORD : DWORD VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_DWORD := in; + ULINT_TO_DWORD := in; END_FUNCTION (******************** @@ -749,9 +749,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_WORD : WORD VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_WORD := in; + ULINT_TO_WORD := in; END_FUNCTION (******************** @@ -761,9 +761,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_BYTE : BYTE VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_BYTE := in; + ULINT_TO_BYTE := in; END_FUNCTION (******************** @@ -773,9 +773,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_LWORD : LWORD VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_LWORD := in; + UDINT_TO_LWORD := in; END_FUNCTION (******************** @@ -785,9 +785,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_DWORD : DWORD VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_DWORD := in; + UDINT_TO_DWORD := in; END_FUNCTION (******************** @@ -797,9 +797,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_WORD : WORD VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_WORD := in; + UDINT_TO_WORD := in; END_FUNCTION (******************** @@ -809,9 +809,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_BYTE : BYTE VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_BYTE := in; + UDINT_TO_BYTE := in; END_FUNCTION (******************** @@ -821,9 +821,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_LWORD : LWORD VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_LWORD := in; + UINT_TO_LWORD := in; END_FUNCTION (******************** @@ -833,9 +833,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_DWORD : DWORD VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_DWORD := in; + UINT_TO_DWORD := in; END_FUNCTION (******************** @@ -845,9 +845,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_WORD : WORD VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_WORD := in; + UINT_TO_WORD := in; END_FUNCTION (******************** @@ -857,9 +857,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_BYTE : BYTE VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_BYTE := in; + UINT_TO_BYTE := in; END_FUNCTION (******************** @@ -869,9 +869,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_LWORD : LWORD VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_LWORD := in; + USINT_TO_LWORD := in; END_FUNCTION (******************** @@ -881,9 +881,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_DWORD : DWORD VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_DWORD := in; + USINT_TO_DWORD := in; END_FUNCTION (******************** @@ -893,9 +893,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_WORD : WORD VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_WORD := in; + USINT_TO_WORD := in; END_FUNCTION (******************** @@ -905,7 +905,7 @@ END_FUNCTION *********************) FUNCTION USINT_TO_BYTE : BYTE VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_BYTE := in; -END_FUNCTION \ No newline at end of file + USINT_TO_BYTE := in; +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/bit_shift_functions.st b/libs/stdlib/iec61131-st/bit_shift_functions.st index d6e6ef3624..74676fef60 100644 --- a/libs/stdlib/iec61131-st/bit_shift_functions.st +++ b/libs/stdlib/iec61131-st/bit_shift_functions.st @@ -1,69 +1,68 @@ (************************** - * + * * SHL(IN, n) - * + * * This operator implements a bitwise shift of an operand to the left. * IN is shifted by n bit to the left and is filled from the right with zeros. - * + * *************************) {external} FUNCTION SHL : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION (************************** - * + * * SHR(IN, n) - * + * * This operator implements a bitwise shift of an operand to the right. - * IN is shifted by n bit to the right. - * If an unsigned data type is used, filling from the left with zeros ensues. - * In the case of signed data types, an arithmetic shifting is implemented, + * IN is shifted by n bit to the right. + * If an unsigned data type is used, filling from the left with zeros ensues. + * In the case of signed data types, an arithmetic shifting is implemented, * i.e. it is filled with the value of the highest bit. - * + * *************************) {external} FUNCTION SHR : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION (************************** - * + * * ROL(IN, n) - * + * * This operator implements a bitwise rotation of an operand to the left. - * IN is shifted n-times to the left, + * IN is shifted n-times to the left, * whereby the highest bit from the right is again inserted. - * + * *************************) {external} -FUNCTION ROL : T +FUNCTION ROL : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION (************************** - * + * * ROR(IN, n) - * + * * This operator implements a bitwise rotation of an operand to the right. - * IN is shifted n-times to the right, + * IN is shifted n-times to the right, * whereby the lowest bit from the left is again inserted. - * + * *************************) {external} -FUNCTION ROR : T +FUNCTION ROR : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION - diff --git a/libs/stdlib/iec61131-st/counters.st b/libs/stdlib/iec61131-st/counters.st index 1b6b72a12b..b83a6330ea 100644 --- a/libs/stdlib/iec61131-st/counters.st +++ b/libs/stdlib/iec61131-st/counters.st @@ -12,16 +12,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU VAR_INPUT - CU : BOOL; - R : BOOL; - PV : INT; + CU : BOOL; + R : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -39,16 +39,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_INT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : INT; + CU : BOOL; + R : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -66,16 +66,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_DINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : DINT; + CU : BOOL; + R : BOOL; + PV : DINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : DINT; + Q : BOOL; + CV : DINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -93,16 +93,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_UDINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : UDINT; + CU : BOOL; + R : BOOL; + PV : UDINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : UDINT; + Q : BOOL; + CV : UDINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -120,16 +120,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_LINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : LINT; + CU : BOOL; + R : BOOL; + PV : LINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : LINT; + Q : BOOL; + CV : LINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -147,16 +147,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_ULINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : ULINT; + CU : BOOL; + R : BOOL; + PV : ULINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : ULINT; + Q : BOOL; + CV : ULINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -174,16 +174,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : INT; + CD : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -201,16 +201,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_INT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : INT; + CD : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -228,16 +228,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_DINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : DINT; + CD : BOOL; + LD : BOOL; + PV : DINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : DINT; + Q : BOOL; + CV : DINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -255,16 +255,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_UDINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : UDINT; + CD : BOOL; + LD : BOOL; + PV : UDINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : UDINT; + Q : BOOL; + CV : UDINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -282,16 +282,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_LINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : LINT; + CD : BOOL; + LD : BOOL; + PV : LINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : LINT; + Q : BOOL; + CV : LINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -309,16 +309,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_ULINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : ULINT; + CD : BOOL; + LD : BOOL; + PV : ULINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : ULINT; + Q : BOOL; + CV : ULINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -339,20 +339,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : INT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : INT; + QU : BOOL; + QD : BOOL; + CV : INT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -373,20 +373,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_INT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : INT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : INT; + QU : BOOL; + QD : BOOL; + CV : INT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -407,20 +407,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_DINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : DINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : DINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : DINT; + QU : BOOL; + QD : BOOL; + CV : DINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -441,20 +441,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_UDINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : UDINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : UDINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : UDINT; + QU : BOOL; + QD : BOOL; + CV : UDINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -475,20 +475,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_LINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : LINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : LINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : LINT; + QU : BOOL; + QD : BOOL; + CV : LINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -509,19 +509,19 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_ULINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : ULINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : ULINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : ULINT; + QU : BOOL; + QD : BOOL; + CV : ULINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR -END_FUNCTION_BLOCK \ No newline at end of file +END_FUNCTION_BLOCK diff --git a/libs/stdlib/iec61131-st/date_time_conversion.st b/libs/stdlib/iec61131-st/date_time_conversion.st index 0615f61332..91bae5d3dc 100644 --- a/libs/stdlib/iec61131-st/date_time_conversion.st +++ b/libs/stdlib/iec61131-st/date_time_conversion.st @@ -6,7 +6,7 @@ {external} FUNCTION DATE_AND_TIME_TO_DATE : DATE VAR_INPUT - in : DT; + in : DT; END_VAR END_FUNCTION @@ -18,7 +18,7 @@ END_FUNCTION {external} FUNCTION DATE_AND_TIME_TO_TIME_OF_DAY : TOD VAR_INPUT - in : DT; + in : DT; END_VAR END_FUNCTION @@ -29,9 +29,9 @@ END_FUNCTION *********************) FUNCTION LTIME_TO_TIME : TIME VAR_INPUT - in : LTIME; + in : LTIME; END_VAR - LTIME_TO_TIME := in; + LTIME_TO_TIME := in; END_FUNCTION (******************** @@ -41,9 +41,9 @@ END_FUNCTION *********************) FUNCTION TIME_TO_LTIME : LTIME VAR_INPUT - in : TIME; + in : TIME; END_VAR - TIME_TO_LTIME := in; + TIME_TO_LTIME := in; END_FUNCTION (******************** @@ -53,9 +53,9 @@ END_FUNCTION *********************) FUNCTION LDT_TO_DT : DT VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_DT := in; + LDT_TO_DT := in; END_FUNCTION (******************** @@ -65,9 +65,9 @@ END_FUNCTION *********************) FUNCTION LDT_TO_DATE : DATE VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_DATE := DATE_AND_TIME_TO_DATE(in); + LDT_TO_DATE := DATE_AND_TIME_TO_DATE(in); END_FUNCTION (******************** @@ -77,9 +77,9 @@ END_FUNCTION *********************) FUNCTION LDT_TO_LTOD : LTOD VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + LDT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -89,9 +89,9 @@ END_FUNCTION *********************) FUNCTION LDT_TO_TOD : TOD VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + LDT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -101,9 +101,9 @@ END_FUNCTION *********************) FUNCTION DT_TO_LDT : LDT VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_LDT := in; + DT_TO_LDT := in; END_FUNCTION (******************** @@ -113,9 +113,9 @@ END_FUNCTION *********************) FUNCTION DT_TO_DATE : DATE VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_DATE := DATE_AND_TIME_TO_DATE(in); + DT_TO_DATE := DATE_AND_TIME_TO_DATE(in); END_FUNCTION (******************** @@ -125,9 +125,9 @@ END_FUNCTION *********************) FUNCTION DT_TO_LTOD : LTOD VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + DT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -137,9 +137,9 @@ END_FUNCTION *********************) FUNCTION DT_TO_TOD : TOD VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + DT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -149,9 +149,9 @@ END_FUNCTION *********************) FUNCTION LTOD_TO_TOD : TOD VAR_INPUT - in : LTOD; + in : LTOD; END_VAR - LTOD_TO_TOD := in; + LTOD_TO_TOD := in; END_FUNCTION (******************** @@ -161,7 +161,7 @@ END_FUNCTION *********************) FUNCTION TOD_TO_LTOD : LTOD VAR_INPUT - in : TOD; + in : TOD; END_VAR - TOD_TO_LTOD := in; -END_FUNCTION \ No newline at end of file + TOD_TO_LTOD := in; +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/date_time_extra_functions.st b/libs/stdlib/iec61131-st/date_time_extra_functions.st index bc28622c51..42d630308a 100644 --- a/libs/stdlib/iec61131-st/date_time_extra_functions.st +++ b/libs/stdlib/iec61131-st/date_time_extra_functions.st @@ -6,8 +6,8 @@ {external} FUNCTION CONCAT_DATE_TOD : DT VAR_INPUT - date_input : DATE; - tod_input : TOD; + date_input : DATE; + tod_input : TOD; END_VAR END_FUNCTION @@ -18,10 +18,10 @@ END_FUNCTION *********************) FUNCTION CONCAT_DATE_LTOD : DT VAR_INPUT - date_input : DATE; - tod_input : LTOD; + date_input : DATE; + tod_input : LTOD; END_VAR - CONCAT_DATE_LTOD := CONCAT_DATE_TOD(date_input, tod_input); + CONCAT_DATE_LTOD := CONCAT_DATE_TOD(date_input, tod_input); END_FUNCTION (******************** @@ -32,9 +32,9 @@ END_FUNCTION {external} FUNCTION CONCAT_DATE : DATE VAR_INPUT - year : T; - month : T; - day : T; + year : T; + month : T; + day : T; END_VAR END_FUNCTION @@ -46,10 +46,10 @@ END_FUNCTION {external} FUNCTION CONCAT_TOD : TOD VAR_INPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -60,99 +60,99 @@ END_FUNCTION *********************) FUNCTION CONCAT_LTOD : LTOD VAR_INPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of CONCAT_LTOD for SINT *) FUNCTION CONCAT_LTOD__SINT : LTOD VAR_INPUT - hour : SINT; - minute : SINT; - second : SINT; - millisecond : SINT; + hour : SINT; + minute : SINT; + second : SINT; + millisecond : SINT; END_VAR - CONCAT_LTOD__SINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__SINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for USINT *) FUNCTION CONCAT_LTOD__USINT : LTOD VAR_INPUT - hour : USINT; - minute : USINT; - second : USINT; - millisecond : USINT; + hour : USINT; + minute : USINT; + second : USINT; + millisecond : USINT; END_VAR - CONCAT_LTOD__USINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__USINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for INT *) FUNCTION CONCAT_LTOD__INT : LTOD VAR_INPUT - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - CONCAT_LTOD__INT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__INT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for UINT *) FUNCTION CONCAT_LTOD__UINT : LTOD VAR_INPUT - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - CONCAT_LTOD__UINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__UINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for DINT *) FUNCTION CONCAT_LTOD__DINT : LTOD VAR_INPUT - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - CONCAT_LTOD__DINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__DINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for UDINT *) FUNCTION CONCAT_LTOD__UDINT : LTOD VAR_INPUT - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - CONCAT_LTOD__UDINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__UDINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for LINT *) FUNCTION CONCAT_LTOD__LINT : LTOD VAR_INPUT - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - CONCAT_LTOD__LINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__LINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for ULINT *) FUNCTION CONCAT_LTOD__ULINT : LTOD VAR_INPUT - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - CONCAT_LTOD__ULINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__ULINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (******************** @@ -162,98 +162,98 @@ END_FUNCTION *********************) FUNCTION CONCAT_DT : DT VAR_INPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of CONCAT_DT for INT *) FUNCTION CONCAT_DT__INT : DT VAR_INPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - CONCAT_DT__INT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__INT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for UINT *) FUNCTION CONCAT_DT__UINT : DT VAR_INPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - CONCAT_DT__UINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__UINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for DINT *) FUNCTION CONCAT_DT__DINT : DT VAR_INPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - CONCAT_DT__DINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__DINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for UDINT *) FUNCTION CONCAT_DT__UDINT : DT VAR_INPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - CONCAT_DT__UDINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__UDINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for LINT *) FUNCTION CONCAT_DT__LINT : DT VAR_INPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - CONCAT_DT__LINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__LINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for ULINT *) FUNCTION CONCAT_DT__ULINT : DT VAR_INPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - CONCAT_DT__ULINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__ULINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (******************** @@ -263,98 +263,98 @@ END_FUNCTION *********************) FUNCTION CONCAT_LDT : LDT VAR_INPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of CONCAT_LDT for INT *) FUNCTION CONCAT_LDT__INT : LDT VAR_INPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - CONCAT_LDT__INT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__INT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for UINT *) FUNCTION CONCAT_LDT__UINT : LDT VAR_INPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - CONCAT_LDT__UINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__UINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for DINT *) FUNCTION CONCAT_LDT__DINT : LDT VAR_INPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - CONCAT_LDT__DINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__DINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for UDINT *) FUNCTION CONCAT_LDT__UDINT : LDT VAR_INPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - CONCAT_LDT__UDINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__UDINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for LINT *) FUNCTION CONCAT_LDT__LINT : LDT VAR_INPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - CONCAT_LDT__LINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__LINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for ULINT *) FUNCTION CONCAT_LDT__ULINT : LDT VAR_INPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - CONCAT_LDT__ULINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__ULINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (******************** @@ -364,12 +364,12 @@ END_FUNCTION *********************) FUNCTION SPLIT_DATE : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : T; - month : T; - day : T; + year : T; + month : T; + day : T; END_VAR END_FUNCTION @@ -377,12 +377,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__INT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : INT; - month : INT; - day : INT; + year : INT; + month : INT; + day : INT; END_VAR END_FUNCTION @@ -390,12 +390,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__UINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : UINT; - month : UINT; - day : UINT; + year : UINT; + month : UINT; + day : UINT; END_VAR END_FUNCTION @@ -403,12 +403,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__DINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : DINT; - month : DINT; - day : DINT; + year : DINT; + month : DINT; + day : DINT; END_VAR END_FUNCTION @@ -416,12 +416,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__UDINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : UDINT; - month : UDINT; - day : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; END_VAR END_FUNCTION @@ -429,12 +429,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__LINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : LINT; - month : LINT; - day : LINT; + year : LINT; + month : LINT; + day : LINT; END_VAR END_FUNCTION @@ -442,12 +442,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__ULINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : ULINT; - month : ULINT; - day : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; END_VAR END_FUNCTION @@ -458,13 +458,13 @@ END_FUNCTION *********************) FUNCTION SPLIT_TOD : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -472,13 +472,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__INT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR END_FUNCTION @@ -486,13 +486,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__UINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR END_FUNCTION @@ -500,13 +500,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__DINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR END_FUNCTION @@ -514,13 +514,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__UDINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR END_FUNCTION @@ -528,13 +528,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__LINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR END_FUNCTION @@ -542,13 +542,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__ULINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR END_FUNCTION @@ -559,98 +559,98 @@ END_FUNCTION *********************) FUNCTION SPLIT_LTOD : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of SPLIT_LTOD for INT *) FUNCTION SPLIT_LTOD__INT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - SPLIT_LTOD__INT := SPLIT_TOD__INT(in, hour, minute, second, millisecond); + SPLIT_LTOD__INT := SPLIT_TOD__INT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for UINT *) FUNCTION SPLIT_LTOD__UINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - SPLIT_LTOD__UINT := SPLIT_TOD__UINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__UINT := SPLIT_TOD__UINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for DINT *) FUNCTION SPLIT_LTOD__DINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - SPLIT_LTOD__DINT := SPLIT_TOD__DINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__DINT := SPLIT_TOD__DINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for UDINT *) FUNCTION SPLIT_LTOD__UDINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - SPLIT_LTOD__UDINT := SPLIT_TOD__UDINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__UDINT := SPLIT_TOD__UDINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for LINT *) FUNCTION SPLIT_LTOD__LINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - SPLIT_LTOD__LINT := SPLIT_TOD__LINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__LINT := SPLIT_TOD__LINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for ULINT *) FUNCTION SPLIT_LTOD__ULINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - SPLIT_LTOD__ULINT := SPLIT_TOD__ULINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__ULINT := SPLIT_TOD__ULINT(in, hour, minute, second, millisecond); END_FUNCTION (******************** @@ -660,16 +660,16 @@ END_FUNCTION *********************) FUNCTION SPLIT_DT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -677,16 +677,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__INT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR END_FUNCTION @@ -694,16 +694,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__UINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR END_FUNCTION @@ -711,16 +711,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__DINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR END_FUNCTION @@ -728,16 +728,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__UDINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR END_FUNCTION @@ -745,16 +745,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__LINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR END_FUNCTION @@ -762,16 +762,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__ULINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR END_FUNCTION @@ -782,16 +782,16 @@ END_FUNCTION *********************) FUNCTION SPLIT_LDT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -799,108 +799,108 @@ END_FUNCTION {external} FUNCTION SPLIT_LDT__INT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - SPLIT_LDT__INT := SPLIT_DT__INT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__INT := SPLIT_DT__INT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for UINT *) {external} FUNCTION SPLIT_LDT__UINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - SPLIT_LDT__UINT := SPLIT_DT__UINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__UINT := SPLIT_DT__UINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for DINT *) {external} FUNCTION SPLIT_LDT__DINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - SPLIT_LDT__DINT := SPLIT_DT__DINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__DINT := SPLIT_DT__DINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for UDINT *) {external} FUNCTION SPLIT_LDT__UDINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - SPLIT_LDT__UDINT := SPLIT_DT__UDINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__UDINT := SPLIT_DT__UDINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for LINT *) {external} FUNCTION SPLIT_LDT__LINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - SPLIT_LDT__LINT := SPLIT_DT__LINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__LINT := SPLIT_DT__LINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for ULINT *) {external} FUNCTION SPLIT_LDT__ULINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - SPLIT_LDT__ULINT := SPLIT_DT__ULINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__ULINT := SPLIT_DT__ULINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (******************** @@ -912,6 +912,6 @@ END_FUNCTION {external} FUNCTION DAY_OF_WEEK : SINT VAR_INPUT - in : DATE; + in : DATE; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/date_time_numeric_functions.st b/libs/stdlib/iec61131-st/date_time_numeric_functions.st index 4c9c167123..9dc5586280 100644 --- a/libs/stdlib/iec61131-st/date_time_numeric_functions.st +++ b/libs/stdlib/iec61131-st/date_time_numeric_functions.st @@ -5,18 +5,18 @@ *********************) FUNCTION ADD : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION (* Specialized implementation of ADD for TIME *) FUNCTION ADD__TIME__TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR - ADD__TIME__TIME := ADD_TIME(IN1, IN2); + ADD__TIME__TIME := ADD_TIME(IN1, IN2); END_FUNCTION (******************** @@ -27,8 +27,8 @@ END_FUNCTION {external} FUNCTION ADD_TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR END_FUNCTION @@ -39,19 +39,19 @@ END_FUNCTION *********************) FUNCTION ADD_LTIME : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : LTIME; + IN1 : LTIME; + IN2 : LTIME; END_VAR - ADD_LTIME := ADD_TIME(IN1, IN2); + ADD_LTIME := ADD_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of ADD for TOD *) FUNCTION ADD__TIME_OF_DAY__TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR - ADD__TIME_OF_DAY__TIME := ADD_TOD_TIME(IN1, IN2); + ADD__TIME_OF_DAY__TIME := ADD_TOD_TIME(IN1, IN2); END_FUNCTION (******************** @@ -63,8 +63,8 @@ END_FUNCTION {external} FUNCTION ADD_TOD_TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR END_FUNCTION @@ -76,19 +76,19 @@ END_FUNCTION *********************) FUNCTION ADD_LTOD_LTIME : LTOD VAR_INPUT - IN1 : LTOD; - IN2 : LTIME; + IN1 : LTOD; + IN2 : LTIME; END_VAR - ADD_LTOD_LTIME := ADD_TOD_TIME(IN1, IN2); + ADD_LTOD_LTIME := ADD_TOD_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of ADD for DT *) FUNCTION ADD__DATE_AND_TIME__TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR - ADD__DATE_AND_TIME__TIME := ADD_DT_TIME(IN1, IN2); + ADD__DATE_AND_TIME__TIME := ADD_DT_TIME(IN1, IN2); END_FUNCTION (******************** @@ -100,8 +100,8 @@ END_FUNCTION {external} FUNCTION ADD_DT_TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR END_FUNCTION @@ -113,10 +113,10 @@ END_FUNCTION *********************) FUNCTION ADD_LDT_LTIME : LDT VAR_INPUT - IN1 : LDT; - IN2 : LTIME; + IN1 : LDT; + IN2 : LTIME; END_VAR - ADD_LDT_LTIME := ADD_DT_TIME(IN1, IN2); + ADD_LDT_LTIME := ADD_DT_TIME(IN1, IN2); END_FUNCTION (******************** @@ -126,18 +126,18 @@ END_FUNCTION *********************) FUNCTION SUB : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION (* Specialized implementation of SUB for TIME *) FUNCTION SUB__TIME__TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR - SUB__TIME__TIME := SUB_TIME(IN1, IN2); + SUB__TIME__TIME := SUB_TIME(IN1, IN2); END_FUNCTION (******************** @@ -148,8 +148,8 @@ END_FUNCTION {external} FUNCTION SUB_TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR END_FUNCTION @@ -160,19 +160,19 @@ END_FUNCTION *********************) FUNCTION SUB_LTIME : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : LTIME; + IN1 : LTIME; + IN2 : LTIME; END_VAR - SUB_LTIME := SUB_TIME(IN1, IN2); + SUB_LTIME := SUB_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for DATE *) FUNCTION SUB__DATE__DATE : TIME VAR_INPUT - IN1 : DATE; - IN2 : DATE; + IN1 : DATE; + IN2 : DATE; END_VAR - SUB__DATE__DATE := SUB_DATE_DATE(IN1, IN2); + SUB__DATE__DATE := SUB_DATE_DATE(IN1, IN2); END_FUNCTION (******************** @@ -184,8 +184,8 @@ END_FUNCTION {external} FUNCTION SUB_DATE_DATE : TIME VAR_INPUT - IN1 : DATE; - IN2 : DATE; + IN1 : DATE; + IN2 : DATE; END_VAR END_FUNCTION @@ -197,19 +197,19 @@ END_FUNCTION *********************) FUNCTION SUB_LDATE_LDATE : LTIME VAR_INPUT - IN1 : LDATE; - IN2 : LDATE; + IN1 : LDATE; + IN2 : LDATE; END_VAR - SUB_LDATE_LDATE := SUB_DATE_DATE(IN1, IN2); + SUB_LDATE_LDATE := SUB_DATE_DATE(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for TOD and TIME *) FUNCTION SUB__TIME_OF_DAY__TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR - SUB__TIME_OF_DAY__TIME := SUB_TOD_TIME(IN1, IN2); + SUB__TIME_OF_DAY__TIME := SUB_TOD_TIME(IN1, IN2); END_FUNCTION (******************** @@ -221,8 +221,8 @@ END_FUNCTION {external} FUNCTION SUB_TOD_TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR END_FUNCTION @@ -234,19 +234,19 @@ END_FUNCTION *********************) FUNCTION SUB_LTOD_LTIME : LTOD VAR_INPUT - IN1 : LTOD; - IN2 : LTIME; + IN1 : LTOD; + IN2 : LTIME; END_VAR - SUB_LTOD_LTIME := SUB_TOD_TIME(IN1, IN2); + SUB_LTOD_LTIME := SUB_TOD_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for TOD *) FUNCTION SUB__TIME_OF_DAY__TIME_OF_DAY : TIME VAR_INPUT - IN1 : TOD; - IN2 : TOD; + IN1 : TOD; + IN2 : TOD; END_VAR - SUB__TIME_OF_DAY__TIME_OF_DAY := SUB_TOD_TOD(IN1, IN2); + SUB__TIME_OF_DAY__TIME_OF_DAY := SUB_TOD_TOD(IN1, IN2); END_FUNCTION (******************** @@ -258,8 +258,8 @@ END_FUNCTION {external} FUNCTION SUB_TOD_TOD : TIME VAR_INPUT - IN1 : TOD; - IN2 : TOD; + IN1 : TOD; + IN2 : TOD; END_VAR END_FUNCTION @@ -271,19 +271,19 @@ END_FUNCTION *********************) FUNCTION SUB_LTOD_LTOD : LTIME VAR_INPUT - IN1 : LTOD; - IN2 : LTOD; + IN1 : LTOD; + IN2 : LTOD; END_VAR - SUB_LTOD_LTOD := SUB_TOD_TOD(IN1, IN2); + SUB_LTOD_LTOD := SUB_TOD_TOD(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for DT and TIME *) FUNCTION SUB__DATE_AND_TIME__TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR - SUB__DATE_AND_TIME__TIME := SUB_DT_TIME(IN1, IN2); + SUB__DATE_AND_TIME__TIME := SUB_DT_TIME(IN1, IN2); END_FUNCTION (******************** @@ -295,8 +295,8 @@ END_FUNCTION {external} FUNCTION SUB_DT_TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR END_FUNCTION @@ -308,19 +308,19 @@ END_FUNCTION *********************) FUNCTION SUB_LDT_LTIME : LDT VAR_INPUT - IN1 : LDT; - IN2 : LTIME; + IN1 : LDT; + IN2 : LTIME; END_VAR - SUB_LDT_LTIME := SUB_DT_TIME(IN1, IN2); + SUB_LDT_LTIME := SUB_DT_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for DT *) FUNCTION SUB__DATE_AND_TIME__DATE_AND_TIME : TIME VAR_INPUT - IN1 : DT; - IN2 : DT; + IN1 : DT; + IN2 : DT; END_VAR - SUB__DATE_AND_TIME__DATE_AND_TIME := SUB_DT_DT(IN1, IN2); + SUB__DATE_AND_TIME__DATE_AND_TIME := SUB_DT_DT(IN1, IN2); END_FUNCTION (******************** @@ -332,8 +332,8 @@ END_FUNCTION {external} FUNCTION SUB_DT_DT : TIME VAR_INPUT - IN1 : DT; - IN2 : DT; + IN1 : DT; + IN2 : DT; END_VAR END_FUNCTION @@ -345,10 +345,10 @@ END_FUNCTION *********************) FUNCTION SUB_LDT_LDT : LTIME VAR_INPUT - IN1 : LDT; - IN2 : LDT; + IN1 : LDT; + IN2 : LDT; END_VAR - SUB_LDT_LDT := SUB_DT_DT(IN1, IN2); + SUB_LDT_LDT := SUB_DT_DT(IN1, IN2); END_FUNCTION (******************** @@ -358,8 +358,8 @@ END_FUNCTION *********************) FUNCTION MUL : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION @@ -370,8 +370,8 @@ END_FUNCTION *********************) FUNCTION MUL_TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : T; + IN1 : TIME; + IN2 : T; END_VAR END_FUNCTION @@ -382,8 +382,8 @@ END_FUNCTION *********************) FUNCTION MUL_LTIME : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : T; + IN1 : LTIME; + IN2 : T; END_VAR END_FUNCTION @@ -394,8 +394,8 @@ END_FUNCTION *********************) FUNCTION DIV : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION @@ -406,8 +406,8 @@ END_FUNCTION *********************) FUNCTION DIV_TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : T; + IN1 : TIME; + IN2 : T; END_VAR END_FUNCTION @@ -418,7 +418,7 @@ END_FUNCTION *********************) FUNCTION DIV_LTIME : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : T; + IN1 : LTIME; + IN2 : T; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/endianness_conversion_functions.st b/libs/stdlib/iec61131-st/endianness_conversion_functions.st index 34bfa01acf..51dba16612 100644 --- a/libs/stdlib/iec61131-st/endianness_conversion_functions.st +++ b/libs/stdlib/iec61131-st/endianness_conversion_functions.st @@ -7,7 +7,7 @@ Return: The value converted to big endian format. {external} FUNCTION TO_BIG_ENDIAN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -20,7 +20,7 @@ Return: The value converted to little endian format. {external} FUNCTION TO_LITTLE_ENDIAN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -33,7 +33,7 @@ Return: The value converted to native endian format. {external} FUNCTION FROM_BIG_ENDIAN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -46,7 +46,6 @@ Return: The value converted to native endian format. {external} FUNCTION FROM_LITTLE_ENDIAN : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION - diff --git a/libs/stdlib/iec61131-st/extra_functions.st b/libs/stdlib/iec61131-st/extra_functions.st index 7f784d6665..c8b0f6796c 100644 --- a/libs/stdlib/iec61131-st/extra_functions.st +++ b/libs/stdlib/iec61131-st/extra_functions.st @@ -1095,4 +1095,4 @@ VAR_INPUT IN : ULINT; END_VAR LWORD_TO_STRING_EXT(IN, ULINT_TO_STRING); -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/flanks.st b/libs/stdlib/iec61131-st/flanks.st index cfa610318b..43abd0ea43 100644 --- a/libs/stdlib/iec61131-st/flanks.st +++ b/libs/stdlib/iec61131-st/flanks.st @@ -1,41 +1,41 @@ (****************************************************************************** Description: Rising Edge detection Input: - - CLK: Signal to detect + - CLK: Signal to detect Output: - - Q: Edge detected + - Q: Edge detected Return: Output variable are used for return. ******************************************************************************) -{external} +{external} FUNCTION_BLOCK R_TRIG VAR_INPUT - CLK: BOOL; + CLK: BOOL; END_VAR VAR_OUTPUT - Q: BOOL; + Q: BOOL; END_VAR VAR - M: BOOL; + M: BOOL; END_VAR END_FUNCTION_BLOCK (****************************************************************************** Description: Falling Edge detection Input: - - CLK: Signal to detect + - CLK: Signal to detect Output: - - Q: Edge detected + - Q: Edge detected Return: Output variable is used for return. ******************************************************************************) -{external} +{external} FUNCTION_BLOCK F_TRIG VAR_INPUT - CLK: BOOL; + CLK: BOOL; END_VAR VAR_OUTPUT - Q: BOOL; + Q: BOOL; END_VAR VAR - M: BOOL; + M: BOOL; END_VAR -END_FUNCTION_BLOCK \ No newline at end of file +END_FUNCTION_BLOCK diff --git a/libs/stdlib/iec61131-st/num_conversion.st b/libs/stdlib/iec61131-st/num_conversion.st index c8479daec6..71dba70843 100644 --- a/libs/stdlib/iec61131-st/num_conversion.st +++ b/libs/stdlib/iec61131-st/num_conversion.st @@ -5,9 +5,9 @@ *********************) FUNCTION LREAL_TO_REAL : REAL VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_REAL := in; + LREAL_TO_REAL := in; END_FUNCTION (******************** @@ -17,9 +17,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_LINT : LINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_LINT := ROUND(in); + LREAL_TO_LINT := ROUND(in); END_FUNCTION (******************** @@ -29,9 +29,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_DINT : DINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_DINT := ROUND(in); + LREAL_TO_DINT := ROUND(in); END_FUNCTION (******************** @@ -41,9 +41,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_INT : INT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_INT := ROUND(in); + LREAL_TO_INT := ROUND(in); END_FUNCTION (******************** @@ -53,9 +53,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_SINT : SINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_SINT := ROUND(in); + LREAL_TO_SINT := ROUND(in); END_FUNCTION (******************** @@ -65,9 +65,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_ULINT : ULINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_ULINT := ROUND(in); + LREAL_TO_ULINT := ROUND(in); END_FUNCTION (******************** @@ -77,9 +77,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_UDINT : UDINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_UDINT := ROUND(in); + LREAL_TO_UDINT := ROUND(in); END_FUNCTION (******************** @@ -89,9 +89,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_UINT : UINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_UINT := ROUND(in); + LREAL_TO_UINT := ROUND(in); END_FUNCTION (******************** @@ -101,9 +101,9 @@ END_FUNCTION *********************) FUNCTION LREAL_TO_USINT : USINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_USINT := ROUND(in); + LREAL_TO_USINT := ROUND(in); END_FUNCTION (******************** @@ -113,9 +113,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_LREAL : LREAL VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_LREAL := in; + REAL_TO_LREAL := in; END_FUNCTION (******************** @@ -125,9 +125,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_LINT : LINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_LINT := ROUND(in); + REAL_TO_LINT := ROUND(in); END_FUNCTION (******************** @@ -137,9 +137,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_DINT : DINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_DINT := ROUND(in); + REAL_TO_DINT := ROUND(in); END_FUNCTION (******************** @@ -149,9 +149,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_INT : INT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_INT := ROUND(in); + REAL_TO_INT := ROUND(in); END_FUNCTION (******************** @@ -161,9 +161,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_SINT : SINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_SINT := ROUND(in); + REAL_TO_SINT := ROUND(in); END_FUNCTION (******************** @@ -173,9 +173,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_ULINT : ULINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_ULINT := ROUND(in); + REAL_TO_ULINT := ROUND(in); END_FUNCTION (******************** @@ -185,9 +185,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_UDINT : UDINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_UDINT := ROUND(in); + REAL_TO_UDINT := ROUND(in); END_FUNCTION (******************** @@ -197,9 +197,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_UINT : UINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_UINT := ROUND(in); + REAL_TO_UINT := ROUND(in); END_FUNCTION (******************** @@ -209,9 +209,9 @@ END_FUNCTION *********************) FUNCTION REAL_TO_USINT : USINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_USINT := ROUND(in); + REAL_TO_USINT := ROUND(in); END_FUNCTION (******************** @@ -221,9 +221,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_LREAL : LREAL VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_LREAL := in; + LINT_TO_LREAL := in; END_FUNCTION (******************** @@ -233,9 +233,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_REAL : REAL VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_REAL := in; + LINT_TO_REAL := in; END_FUNCTION (******************** @@ -245,9 +245,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_DINT : DINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_DINT := in; + LINT_TO_DINT := in; END_FUNCTION (******************** @@ -257,9 +257,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_INT : INT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_INT := in; + LINT_TO_INT := in; END_FUNCTION (******************** @@ -269,9 +269,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_SINT : SINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_SINT := in; + LINT_TO_SINT := in; END_FUNCTION (******************** @@ -281,9 +281,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_ULINT : ULINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_ULINT := in; + LINT_TO_ULINT := in; END_FUNCTION (******************** @@ -293,9 +293,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_UDINT : UDINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_UDINT := in; + LINT_TO_UDINT := in; END_FUNCTION (******************** @@ -305,9 +305,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_UINT : UINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_UINT := in; + LINT_TO_UINT := in; END_FUNCTION (******************** @@ -317,9 +317,9 @@ END_FUNCTION *********************) FUNCTION LINT_TO_USINT : USINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_USINT := in; + LINT_TO_USINT := in; END_FUNCTION (******************** @@ -329,9 +329,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_LREAL : LREAL VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_LREAL := in; + DINT_TO_LREAL := in; END_FUNCTION (******************** @@ -341,9 +341,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_REAL : REAL VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_REAL := in; + DINT_TO_REAL := in; END_FUNCTION (******************** @@ -353,9 +353,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_LINT : LINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_LINT := in; + DINT_TO_LINT := in; END_FUNCTION (******************** @@ -365,9 +365,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_INT : INT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_INT := in; + DINT_TO_INT := in; END_FUNCTION (******************** @@ -377,9 +377,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_SINT : SINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_SINT := in; + DINT_TO_SINT := in; END_FUNCTION (******************** @@ -389,9 +389,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_ULINT : ULINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_ULINT := in; + DINT_TO_ULINT := in; END_FUNCTION (******************** @@ -401,9 +401,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_UDINT : UDINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_UDINT := in; + DINT_TO_UDINT := in; END_FUNCTION (******************** @@ -413,9 +413,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_UINT : UINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_UINT := in; + DINT_TO_UINT := in; END_FUNCTION (******************** @@ -425,9 +425,9 @@ END_FUNCTION *********************) FUNCTION DINT_TO_USINT : USINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_USINT := in; + DINT_TO_USINT := in; END_FUNCTION (******************** @@ -437,9 +437,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_LREAL : LREAL VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_LREAL := in; + INT_TO_LREAL := in; END_FUNCTION (******************** @@ -449,9 +449,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_REAL : REAL VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_REAL := in; + INT_TO_REAL := in; END_FUNCTION (******************** @@ -461,9 +461,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_LINT : LINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_LINT := in; + INT_TO_LINT := in; END_FUNCTION (******************** @@ -473,9 +473,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_DINT : DINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_DINT := in; + INT_TO_DINT := in; END_FUNCTION (******************** @@ -485,9 +485,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_SINT : SINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_SINT := in; + INT_TO_SINT := in; END_FUNCTION (******************** @@ -497,9 +497,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_ULINT : ULINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_ULINT := in; + INT_TO_ULINT := in; END_FUNCTION (******************** @@ -509,9 +509,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_UDINT : UDINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_UDINT := in; + INT_TO_UDINT := in; END_FUNCTION (******************** @@ -521,9 +521,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_UINT : UINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_UINT := in; + INT_TO_UINT := in; END_FUNCTION (******************** @@ -533,9 +533,9 @@ END_FUNCTION *********************) FUNCTION INT_TO_USINT : USINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_USINT := in; + INT_TO_USINT := in; END_FUNCTION (******************** @@ -545,9 +545,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_LREAL : LREAL VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_LREAL := in; + SINT_TO_LREAL := in; END_FUNCTION (******************** @@ -557,9 +557,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_REAL : REAL VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_REAL := in; + SINT_TO_REAL := in; END_FUNCTION (******************** @@ -569,9 +569,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_LINT : LINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_LINT := in; + SINT_TO_LINT := in; END_FUNCTION (******************** @@ -581,9 +581,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_DINT : DINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_DINT := in; + SINT_TO_DINT := in; END_FUNCTION (******************** @@ -593,9 +593,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_INT : INT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_INT := in; + SINT_TO_INT := in; END_FUNCTION (******************** @@ -605,9 +605,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_ULINT : ULINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_ULINT := in; + SINT_TO_ULINT := in; END_FUNCTION (******************** @@ -617,9 +617,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_UDINT : UDINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_UDINT := in; + SINT_TO_UDINT := in; END_FUNCTION (******************** @@ -629,9 +629,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_UINT : UINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_UINT := in; + SINT_TO_UINT := in; END_FUNCTION (******************** @@ -641,9 +641,9 @@ END_FUNCTION *********************) FUNCTION SINT_TO_USINT : USINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_USINT := in; + SINT_TO_USINT := in; END_FUNCTION (******************** @@ -653,9 +653,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_LREAL : LREAL VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_LREAL := in; + ULINT_TO_LREAL := in; END_FUNCTION (******************** @@ -665,9 +665,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_REAL : REAL VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_REAL := in; + ULINT_TO_REAL := in; END_FUNCTION (******************** @@ -677,9 +677,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_LINT : LINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_LINT := in; + ULINT_TO_LINT := in; END_FUNCTION (******************** @@ -689,9 +689,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_DINT : DINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_DINT := in; + ULINT_TO_DINT := in; END_FUNCTION (******************** @@ -701,9 +701,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_INT : INT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_INT := in; + ULINT_TO_INT := in; END_FUNCTION (******************** @@ -713,9 +713,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_SINT : SINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_SINT := in; + ULINT_TO_SINT := in; END_FUNCTION (******************** @@ -725,9 +725,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_UDINT : UDINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_UDINT := in; + ULINT_TO_UDINT := in; END_FUNCTION (******************** @@ -737,9 +737,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_UINT : UINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_UINT := in; + ULINT_TO_UINT := in; END_FUNCTION (******************** @@ -749,9 +749,9 @@ END_FUNCTION *********************) FUNCTION ULINT_TO_USINT : USINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_USINT := in; + ULINT_TO_USINT := in; END_FUNCTION (******************** @@ -761,9 +761,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_LREAL : LREAL VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_LREAL := in; + UDINT_TO_LREAL := in; END_FUNCTION (******************** @@ -773,9 +773,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_REAL : REAL VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_REAL := in; + UDINT_TO_REAL := in; END_FUNCTION (******************** @@ -785,9 +785,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_LINT : LINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_LINT := in; + UDINT_TO_LINT := in; END_FUNCTION (******************** @@ -797,9 +797,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_DINT : DINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_DINT := in; + UDINT_TO_DINT := in; END_FUNCTION (******************** @@ -809,9 +809,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_INT : INT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_INT := in; + UDINT_TO_INT := in; END_FUNCTION (******************** @@ -821,9 +821,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_SINT : SINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_SINT := in; + UDINT_TO_SINT := in; END_FUNCTION (******************** @@ -833,9 +833,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_ULINT : ULINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_ULINT := in; + UDINT_TO_ULINT := in; END_FUNCTION (******************** @@ -845,9 +845,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_UINT : UINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_UINT := in; + UDINT_TO_UINT := in; END_FUNCTION (******************** @@ -857,9 +857,9 @@ END_FUNCTION *********************) FUNCTION UDINT_TO_USINT : USINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_USINT := in; + UDINT_TO_USINT := in; END_FUNCTION (******************** @@ -869,9 +869,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_LREAL : LREAL VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_LREAL := in; + UINT_TO_LREAL := in; END_FUNCTION (******************** @@ -881,9 +881,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_REAL : REAL VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_REAL := in; + UINT_TO_REAL := in; END_FUNCTION (******************** @@ -893,9 +893,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_LINT : LINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_LINT := in; + UINT_TO_LINT := in; END_FUNCTION (******************** @@ -905,9 +905,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_DINT : DINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_DINT := in; + UINT_TO_DINT := in; END_FUNCTION (******************** @@ -917,9 +917,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_INT : INT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_INT := in; + UINT_TO_INT := in; END_FUNCTION (******************** @@ -929,9 +929,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_SINT : SINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_SINT := in; + UINT_TO_SINT := in; END_FUNCTION (******************** @@ -941,9 +941,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_ULINT : ULINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_ULINT := in; + UINT_TO_ULINT := in; END_FUNCTION (******************** @@ -953,9 +953,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_UDINT : UDINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_UDINT := in; + UINT_TO_UDINT := in; END_FUNCTION (******************** @@ -965,9 +965,9 @@ END_FUNCTION *********************) FUNCTION UINT_TO_USINT : USINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_USINT := in; + UINT_TO_USINT := in; END_FUNCTION (******************** @@ -977,9 +977,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_LREAL : LREAL VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_LREAL := in; + USINT_TO_LREAL := in; END_FUNCTION (******************** @@ -989,9 +989,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_REAL : REAL VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_REAL := in; + USINT_TO_REAL := in; END_FUNCTION (******************** @@ -1001,9 +1001,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_LINT : LINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_LINT := in; + USINT_TO_LINT := in; END_FUNCTION (******************** @@ -1013,9 +1013,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_DINT : DINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_DINT := in; + USINT_TO_DINT := in; END_FUNCTION (******************** @@ -1025,9 +1025,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_INT : INT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_INT := in; + USINT_TO_INT := in; END_FUNCTION (******************** @@ -1037,9 +1037,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_SINT : SINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_SINT := in; + USINT_TO_SINT := in; END_FUNCTION (******************** @@ -1049,9 +1049,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_ULINT : ULINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_ULINT := in; + USINT_TO_ULINT := in; END_FUNCTION (******************** @@ -1061,9 +1061,9 @@ END_FUNCTION *********************) FUNCTION USINT_TO_UDINT : UDINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_UDINT := in; + USINT_TO_UDINT := in; END_FUNCTION (******************** @@ -1073,7 +1073,7 @@ END_FUNCTION *********************) FUNCTION USINT_TO_UINT : UINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_UINT := in; -END_FUNCTION \ No newline at end of file + USINT_TO_UINT := in; +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/numerical_functions.st b/libs/stdlib/iec61131-st/numerical_functions.st index 7374d9f93d..398034000a 100644 --- a/libs/stdlib/iec61131-st/numerical_functions.st +++ b/libs/stdlib/iec61131-st/numerical_functions.st @@ -1,11 +1,11 @@ (************************** - * + * *This operator returns the absolute value of a number. - * + * *************************) -FUNCTION ABS : T +FUNCTION ABS : T VAR_INPUT - IN : T; + IN : T; END_VAR END_FUNCTION @@ -14,69 +14,69 @@ END_FUNCTION /* FUNCTION ABS__DINT : DINT */ FUNCTION ABS__DINT : DINT VAR_INPUT - IN : DINT; + IN : DINT; END_VAR - ABS__DINT := IN; - IF ABS__DINT < 0 THEN - ABS__DINT := -1 * ABS__DINT; - END_IF + ABS__DINT := IN; + IF ABS__DINT < 0 THEN + ABS__DINT := -1 * ABS__DINT; + END_IF END_FUNCTION (* Specialized implementation of ABS for SINT *) FUNCTION ABS__SINT : SINT VAR_INPUT - IN : SINT; + IN : SINT; END_VAR - ABS__SINT := ABS__DINT(IN); + ABS__SINT := ABS__DINT(IN); END_FUNCTION (* Specialized implementation of ABS for INT *) FUNCTION ABS__INT : INT VAR_INPUT - IN : INT; + IN : INT; END_VAR - ABS__INT := ABS__DINT(IN); + ABS__INT := ABS__DINT(IN); END_FUNCTION (* Specialized implementation of ABS for LINT *) FUNCTION ABS__LINT : LINT VAR_INPUT - IN : LINT; + IN : LINT; END_VAR - ABS__LINT := IN; - IF ABS__LINT < 0 THEN - ABS__LINT := -1 * ABS__LINT; - END_IF + ABS__LINT := IN; + IF ABS__LINT < 0 THEN + ABS__LINT := -1 * ABS__LINT; + END_IF END_FUNCTION (* Specialized implementation of ABS for REAL *) FUNCTION ABS__REAL : REAL VAR_INPUT - IN : REAL; + IN : REAL; END_VAR - ABS__REAL := ABS__LREAL(IN); + ABS__REAL := ABS__LREAL(IN); END_FUNCTION (* Specialized implementation of ABS for LREAL *) FUNCTION ABS__LREAL : LREAL VAR_INPUT - IN : LREAL; + IN : LREAL; END_VAR - ABS__LREAL := IN; - IF ABS__LREAL < 0 THEN - ABS__LREAL := -1.0 * ABS__LREAL; - END_IF + ABS__LREAL := IN; + IF ABS__LREAL < 0 THEN + ABS__LREAL := -1.0 * ABS__LREAL; + END_IF END_FUNCTION (************************** - * + * * Rounds a given ANY_REAL to the nearest integer * Rounds half values away from zero - * + * *************************) {external} -FUNCTION ROUND : T +FUNCTION ROUND : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION diff --git a/libs/stdlib/iec61131-st/selectors.st b/libs/stdlib/iec61131-st/selectors.st index df70b0eb85..c6a48676b9 100644 --- a/libs/stdlib/iec61131-st/selectors.st +++ b/libs/stdlib/iec61131-st/selectors.st @@ -1,9 +1,9 @@ (************************** - * + * * MAX(IN0, IN1, ...) - * + * * This operator produces the larger value of the given operands. - * + * *************************) {external} FUNCTION MAX : T @@ -13,11 +13,11 @@ END_VAR END_FUNCTION (************************** - * + * * MIN(IN0, IN1, ...) - * + * * This operator produces the smaller value of the given operands. - * + * *************************) {external} FUNCTION MIN : T @@ -27,14 +27,14 @@ END_VAR END_FUNCTION (************************** - * + * * LIMIT(Min, IN, Max) - * + * * This operator limits an input value to the range between Min and Max. * If IN lies between the range of Min and Max, IN is displayed as a result. * If IN > Max, Max is displayed as a result. * If IN < Min, Min is displayed as a result. - * + * *************************) {external} FUNCTION LIMIT : T @@ -43,4 +43,4 @@ VAR_INPUT IN : T; MAX : T; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/string_conversion.st b/libs/stdlib/iec61131-st/string_conversion.st index 31b1919ed7..1903738316 100644 --- a/libs/stdlib/iec61131-st/string_conversion.st +++ b/libs/stdlib/iec61131-st/string_conversion.st @@ -5,18 +5,18 @@ *********************) FUNCTION WSTRING_TO_STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - in : WSTRING[__STRING_LENGTH]; + in : WSTRING[__STRING_LENGTH]; END_VAR - WSTRING_TO_STRING_EXT(in, WSTRING_TO_STRING); + WSTRING_TO_STRING_EXT(in, WSTRING_TO_STRING); END_FUNCTION {external} FUNCTION WSTRING_TO_STRING_EXT : DINT VAR_INPUT {ref} - in : WSTRING[__STRING_LENGTH]; + in : WSTRING[__STRING_LENGTH]; END_VAR -VAR_IN_OUT - out : STRING[__STRING_LENGTH]; +VAR_IN_OUT + out : STRING[__STRING_LENGTH]; END_VAR END_FUNCTION @@ -27,13 +27,13 @@ END_FUNCTION *********************) FUNCTION WSTRING_TO_WCHAR : WCHAR VAR_INPUT {ref} - in : WSTRING; + in : WSTRING; END_VAR VAR - ptr : REF_TO WCHAR; + ptr : REF_TO WCHAR; END_VAR - ptr := ∈ - WSTRING_TO_WCHAR := ptr^; + ptr := ∈ + WSTRING_TO_WCHAR := ptr^; END_FUNCTION (******************** @@ -44,18 +44,18 @@ END_FUNCTION *********************) FUNCTION STRING_TO_WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - in : STRING[__STRING_LENGTH]; + in : STRING[__STRING_LENGTH]; END_VAR - STRING_TO_WSTRING_EXT(in, STRING_TO_WSTRING); + STRING_TO_WSTRING_EXT(in, STRING_TO_WSTRING); END_FUNCTION {external} FUNCTION STRING_TO_WSTRING_EXT : DINT VAR_INPUT {ref} - in : STRING[__STRING_LENGTH]; + in : STRING[__STRING_LENGTH]; END_VAR VAR_IN_OUT - out : WSTRING[__STRING_LENGTH]; + out : WSTRING[__STRING_LENGTH]; END_VAR END_FUNCTION @@ -66,13 +66,13 @@ END_FUNCTION *********************) FUNCTION STRING_TO_CHAR : CHAR VAR_INPUT {ref} - in : STRING; + in : STRING; END_VAR VAR - ptr : REF_TO CHAR; + ptr : REF_TO CHAR; END_VAR - ptr := ∈ - STRING_TO_CHAR := ptr^; + ptr := ∈ + STRING_TO_CHAR := ptr^; END_FUNCTION (******************** @@ -82,13 +82,13 @@ END_FUNCTION *********************) FUNCTION WCHAR_TO_WSTRING : WSTRING VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR VAR - ptr : REF_TO WSTRING; + ptr : REF_TO WSTRING; END_VAR - ptr := ∈ - WCHAR_TO_WSTRING := ptr^; + ptr := ∈ + WCHAR_TO_WSTRING := ptr^; END_FUNCTION (******************** @@ -99,7 +99,7 @@ END_FUNCTION {external} FUNCTION WCHAR_TO_CHAR : CHAR VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR END_FUNCTION @@ -110,13 +110,13 @@ END_FUNCTION *********************) FUNCTION CHAR_TO_STRING : STRING VAR_INPUT - in : CHAR; + in : CHAR; END_VAR VAR - ptr : REF_TO STRING; + ptr : REF_TO STRING; END_VAR - ptr := ∈ - CHAR_TO_STRING := ptr^; + ptr := ∈ + CHAR_TO_STRING := ptr^; END_FUNCTION (******************** @@ -127,6 +127,6 @@ END_FUNCTION {external} FUNCTION CHAR_TO_WCHAR : WCHAR VAR_INPUT - in : CHAR; + in : CHAR; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/string_functions.st b/libs/stdlib/iec61131-st/string_functions.st index 4095e2ee89..01af032984 100644 --- a/libs/stdlib/iec61131-st/string_functions.st +++ b/libs/stdlib/iec61131-st/string_functions.st @@ -11,7 +11,7 @@ Return: String length {external} FUNCTION LEN : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR END_FUNCTION @@ -24,7 +24,7 @@ Return: A substring consisting of the leftmost L characters of IN ******************************************************************************) FUNCTION LEFT : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -34,7 +34,7 @@ END_FUNCTION {external} FUNCTION LEFT_EXT : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -46,7 +46,7 @@ END_FUNCTION FUNCTION LEFT__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -56,7 +56,7 @@ END_FUNCTION FUNCTION LEFT__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -67,7 +67,7 @@ END_FUNCTION {external} FUNCTION LEFT_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -80,7 +80,7 @@ END_FUNCTION {external} FUNCTION LEFT_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -99,7 +99,7 @@ Return: A substring consisting of the rightmost L characters of IN ******************************************************************************) FUNCTION RIGHT : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -109,7 +109,7 @@ END_FUNCTION {external} FUNCTION RIGHT_EXT : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -121,7 +121,7 @@ END_FUNCTION FUNCTION RIGHT__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -131,7 +131,7 @@ END_FUNCTION FUNCTION RIGHT__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -142,7 +142,7 @@ END_FUNCTION {external} FUNCTION RIGHT_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -155,7 +155,7 @@ END_FUNCTION {external} FUNCTION RIGHT_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -177,7 +177,7 @@ Return: ******************************************************************************) FUNCTION MID : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -188,7 +188,7 @@ END_FUNCTION {external} FUNCTION MID_EXT : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -201,7 +201,7 @@ END_FUNCTION FUNCTION MID__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -212,7 +212,7 @@ END_FUNCTION FUNCTION MID__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -224,7 +224,7 @@ END_FUNCTION {external} FUNCTION MID_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -238,7 +238,7 @@ END_FUNCTION {external} FUNCTION MID_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -261,20 +261,20 @@ Return: {external} FUNCTION CONCAT__STRING : STRING[2048] VAR_INPUT {ref} - args : {sized} STRING...; + args : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION CONCAT__WSTRING : WSTRING[2048] VAR_INPUT {ref} - args : {sized} WSTRING...; + args : {sized} WSTRING...; END_VAR END_FUNCTION FUNCTION CONCAT : T VAR_INPUT {ref} - args : {sized} T...; + args : {sized} T...; END_VAR END_FUNCTION @@ -299,7 +299,7 @@ Return: ******************************************************************************) FUNCTION INSERT : T VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR VAR_INPUT @@ -310,7 +310,7 @@ END_FUNCTION {external} FUNCTION INSERT_EXT : DINT VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR VAR_INPUT @@ -323,7 +323,7 @@ END_FUNCTION FUNCTION INSERT__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN1 : STRING[__STRING_LENGTH]; + IN1 : STRING[__STRING_LENGTH]; IN2 : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -334,7 +334,7 @@ END_FUNCTION FUNCTION INSERT__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN1 : WSTRING[__STRING_LENGTH]; + IN1 : WSTRING[__STRING_LENGTH]; IN2 : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -346,7 +346,7 @@ END_FUNCTION {external} FUNCTION INSERT_EXT__STRING : DINT VAR_INPUT {ref} - IN1 : STRING[__STRING_LENGTH]; + IN1 : STRING[__STRING_LENGTH]; IN2 : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -360,7 +360,7 @@ END_FUNCTION {external} FUNCTION INSERT_EXT__WSTRING : DINT VAR_INPUT {ref} - IN1 : WSTRING[__STRING_LENGTH]; + IN1 : WSTRING[__STRING_LENGTH]; IN2 : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -381,7 +381,7 @@ Return: A new string with L characters deleted from P onwards ******************************************************************************) FUNCTION DELETE : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -392,7 +392,7 @@ END_FUNCTION {external} FUNCTION DELETE_EXT : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -405,7 +405,7 @@ END_FUNCTION FUNCTION DELETE__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -416,7 +416,7 @@ END_FUNCTION FUNCTION DELETE__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -428,7 +428,7 @@ END_FUNCTION {external} FUNCTION DELETE_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -442,7 +442,7 @@ END_FUNCTION {external} FUNCTION DELETE_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -463,7 +463,7 @@ Return: A new string which has L characters replaced by IN2 from position P onwa ******************************************************************************) FUNCTION REPLACE : T VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR VAR_INPUT @@ -489,7 +489,7 @@ END_FUNCTION FUNCTION REPLACE__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN1 : STRING[__STRING_LENGTH]; + IN1 : STRING[__STRING_LENGTH]; IN2 : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -552,7 +552,7 @@ Return: The character index of the first match. 0 if there are no matches. {external} FUNCTION FIND : DINT VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR END_FUNCTION @@ -567,21 +567,21 @@ Return: {external} FUNCTION GT : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION {external} FUNCTION GT__STRING : BOOL VAR_INPUT {ref} - IN1 : {sized} STRING...; + IN1 : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION GT__WSTRING : BOOL VAR_INPUT {ref} - IN1 : {sized} WSTRING...; + IN1 : {sized} WSTRING...; END_VAR END_FUNCTION @@ -610,21 +610,21 @@ Return: {external} FUNCTION GE : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION {external} FUNCTION GE__STRING : BOOL VAR_INPUT {ref} - IN1 : {sized} STRING...; + IN1 : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION GE__WSTRING : BOOL VAR_INPUT {ref} - IN1 : {sized} WSTRING...; + IN1 : {sized} WSTRING...; END_VAR END_FUNCTION @@ -638,21 +638,21 @@ Return: {external} FUNCTION EQ : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION {external} FUNCTION EQ__STRING : BOOL VAR_INPUT {ref} - IN1 : {sized} STRING...; + IN1 : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION EQ__WSTRING : BOOL VAR_INPUT {ref} - IN1 : {sized} WSTRING...; + IN1 : {sized} WSTRING...; END_VAR END_FUNCTION @@ -680,21 +680,21 @@ Return: {external} FUNCTION LE : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION {external} FUNCTION LE__STRING : BOOL VAR_INPUT {ref} - IN1 : {sized} STRING...; + IN1 : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION LE__WSTRING : BOOL VAR_INPUT {ref} - IN1 : {sized} WSTRING...; + IN1 : {sized} WSTRING...; END_VAR END_FUNCTION @@ -708,21 +708,21 @@ Return: {external} FUNCTION LT : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION {external} FUNCTION LT__STRING : BOOL VAR_INPUT {ref} - IN1 : {sized} STRING...; + IN1 : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION LT__WSTRING : BOOL VAR_INPUT {ref} - IN1 : {sized} WSTRING...; + IN1 : {sized} WSTRING...; END_VAR END_FUNCTION @@ -750,7 +750,7 @@ Return: {external} FUNCTION NE : BOOL VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/iec61131-st/timers.st b/libs/stdlib/iec61131-st/timers.st index 8fb65477d9..7b3faea699 100644 --- a/libs/stdlib/iec61131-st/timers.st +++ b/libs/stdlib/iec61131-st/timers.st @@ -1,18 +1,18 @@ {external} (****************************************************************************** -Description: Timer Pulse +Description: Timer Pulse Input: - - IN: Trigger for Start of the Signal + - IN: Trigger for Start of the Signal - PT: The length of the High-Signal Output: - - Q: The pulse - - ET: The current phase of the High-Signal + - Q: The pulse + - ET: The current phase of the High-Signal Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TP VAR_INPUT IN : BOOL; - PT : TIME; + PT : TIME; END_VAR VAR_OUTPUT Q : BOOL; @@ -26,19 +26,19 @@ END_FUNCTION_BLOCK {external} (****************************************************************************** -Description: Timer Pulse +Description: Timer Pulse Input: - - IN: Trigger for Start of the Signal + - IN: Trigger for Start of the Signal - PT: The length of the High-Signal Output: - - Q: The pulse - - ET: The current phase of the High-Signal + - Q: The pulse + - ET: The current phase of the High-Signal Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TP_TIME VAR_INPUT IN : BOOL; - PT : TIME; + PT : TIME; END_VAR VAR_OUTPUT Q : BOOL; @@ -52,19 +52,19 @@ END_FUNCTION_BLOCK {external} (****************************************************************************** -Description: Timer Pulse +Description: Timer Pulse Input: - - IN: Trigger for Start of the Signal + - IN: Trigger for Start of the Signal - PT: The length of the High-Signal Output: - - Q: The pulse - - ET: The current phase of the High-Signal + - Q: The pulse + - ET: The current phase of the High-Signal Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TP_LTIME VAR_INPUT IN : BOOL; - PT : TIME; + PT : TIME; END_VAR VAR_OUTPUT Q : BOOL; @@ -80,21 +80,21 @@ END_FUNCTION_BLOCK (****************************************************************************** Description: Timer on delay. Input: - - IN: Starts timer with rising edge, resets timer with falling edge - - PT: Time to pass, before Q is set + - IN: Starts timer with rising edge, resets timer with falling edge + - PT: Time to pass, before Q is set Output: - - Q: Is TRUE, PT seconds after IN had a rising edge - - ET: Elapsed time + - Q: Is TRUE, PT seconds after IN had a rising edge + - ET: Elapsed time Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TON VAR_INPUT - IN: BOOL; - PT: TIME; + IN: BOOL; + PT: TIME; END_VAR VAR_OUTPUT - Q: BOOL; - ET: TIME; + Q: BOOL; + ET: TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -106,21 +106,21 @@ END_FUNCTION_BLOCK (****************************************************************************** Description: Timer on delay. Input: - - IN: Starts timer with rising edge, resets timer with falling edge - - PT: Time to pass, before Q is set + - IN: Starts timer with rising edge, resets timer with falling edge + - PT: Time to pass, before Q is set Output: - - Q: Is TRUE, PT seconds after IN had a rising edge - - ET: Elapsed time + - Q: Is TRUE, PT seconds after IN had a rising edge + - ET: Elapsed time Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TON_TIME VAR_INPUT - IN: BOOL; - PT: TIME; + IN: BOOL; + PT: TIME; END_VAR VAR_OUTPUT - Q: BOOL; - ET: TIME; + Q: BOOL; + ET: TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -132,21 +132,21 @@ END_FUNCTION_BLOCK (****************************************************************************** Description: Timer on delay. Input: - - IN: Starts timer with rising edge, resets timer with falling edge - - PT: Time to pass, before Q is set + - IN: Starts timer with rising edge, resets timer with falling edge + - PT: Time to pass, before Q is set Output: - - Q: Is TRUE, PT seconds after IN had a rising edge - - ET: Elapsed time + - Q: Is TRUE, PT seconds after IN had a rising edge + - ET: Elapsed time Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TON_LTIME VAR_INPUT - IN: BOOL; - PT: LTIME; + IN: BOOL; + PT: LTIME; END_VAR VAR_OUTPUT - Q: BOOL; - ET: TIME; + Q: BOOL; + ET: TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -158,21 +158,21 @@ END_FUNCTION_BLOCK (****************************************************************************** Description: Timer of delay Input: - - IN: Starts timer with falling edge, resets timer with rising edge - - PT: Time to pass, before Q is set + - IN: Starts timer with falling edge, resets timer with rising edge + - PT: Time to pass, before Q is set Output: - Q: is FALSE, PT seconds after IN had a falling edge - - ET: Elapsed time + - ET: Elapsed time Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TOF VAR_INPUT - IN: BOOL; - PT:TIME; + IN: BOOL; + PT:TIME; END_VAR VAR_OUTPUT - Q: BOOL; - ET: TIME; + Q: BOOL; + ET: TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -184,21 +184,21 @@ END_FUNCTION_BLOCK (****************************************************************************** Description: Timer of delay Input: - - IN: Starts timer with falling edge, resets timer with rising edge - - PT: Time to pass, before Q is set + - IN: Starts timer with falling edge, resets timer with rising edge + - PT: Time to pass, before Q is set Output: - Q: is FALSE, PT seconds after IN had a falling edge - - ET: Elapsed time + - ET: Elapsed time Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TOF_TIME VAR_INPUT - IN: BOOL; - PT:TIME; + IN: BOOL; + PT:TIME; END_VAR VAR_OUTPUT - Q: BOOL; - ET: TIME; + Q: BOOL; + ET: TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -210,24 +210,24 @@ END_FUNCTION_BLOCK (****************************************************************************** Description: Timer of delay Input: - - IN: Starts timer with falling edge, resets timer with rising edge - - PT: Time to pass, before Q is set + - IN: Starts timer with falling edge, resets timer with rising edge + - PT: Time to pass, before Q is set Output: - Q: is FALSE, PT seconds after IN had a falling edge - - ET: Elapsed time + - ET: Elapsed time Return: Output variables are used for return. ******************************************************************************) FUNCTION_BLOCK TOF_LTIME VAR_INPUT - IN: BOOL; - PT:LTIME; + IN: BOOL; + PT:LTIME; END_VAR VAR_OUTPUT - Q: BOOL; - ET: LTIME; + Q: BOOL; + ET: LTIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) __BUFFER__ : ARRAY[1..24] OF BYTE; (* Buffer used for internal implementation *) END_VAR -END_FUNCTION_BLOCK \ No newline at end of file +END_FUNCTION_BLOCK diff --git a/libs/stdlib/iec61131-st/validation_functions.st b/libs/stdlib/iec61131-st/validation_functions.st index 738eb66244..39086c3dd7 100644 --- a/libs/stdlib/iec61131-st/validation_functions.st +++ b/libs/stdlib/iec61131-st/validation_functions.st @@ -9,7 +9,7 @@ Return: {external} FUNCTION IS_VALID : BOOL VAR_INPUT - IN : T; + IN : T; END_VAR END_FUNCTION @@ -26,6 +26,6 @@ Return: {external} FUNCTION IS_VALID_BCD : BOOL VAR_INPUT - IN : T; + IN : T; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/libs/stdlib/tests/arithmetic_functions_tests.rs b/libs/stdlib/tests/arithmetic_functions_tests.rs index 87411b1914..6327fd5942 100644 --- a/libs/stdlib/tests/arithmetic_functions_tests.rs +++ b/libs/stdlib/tests/arithmetic_functions_tests.rs @@ -186,7 +186,7 @@ fn sin_called_on_real() { a,b : REAL; END_VAR a := SIN(FRAC_PI_2_REAL) - REAL#1.0; - b := SIN(REAL#0.0); + b := SIN(REAL#0.0); END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -204,7 +204,7 @@ fn sin_called_on_lreal() { a,b : LREAL; END_VAR a := SIN(FRAC_PI_2_LREAL) - LREAL#1.0; - b := SIN(LREAL#0.0); + b := SIN(LREAL#0.0); END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -221,8 +221,8 @@ fn cos_called_on_real() { VAR a,b : REAL; END_VAR - a := COS(PI_REAL) + REAL#1.0; - b := COS(REAL#0.0) - REAL#1.0; + a := COS(PI_REAL) + REAL#1.0; + b := COS(REAL#0.0) - REAL#1.0; END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -239,8 +239,8 @@ fn cos_called_on_lreal() { VAR a,b : LREAL; END_VAR - a := COS(PI_LREAL) + LREAL#1.0; - b := COS(LREAL#0.0) - LREAL#1.0; + a := COS(PI_LREAL) + LREAL#1.0; + b := COS(LREAL#0.0) - LREAL#1.0; END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -257,8 +257,8 @@ fn tan_called_on_real() { VAR a,b : REAL; END_VAR - a := TAN(FRAC_PI_4_REAL) - REAL#1.0; - b := TAN(PI_REAL); + a := TAN(FRAC_PI_4_REAL) - REAL#1.0; + b := TAN(PI_REAL); END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -275,8 +275,8 @@ fn tan_called_on_lreal() { VAR a,b : LREAL; END_VAR - a := TAN(FRAC_PI_4_LREAL) - LREAL#1.0; - a := TAN(PI_LREAL); + a := TAN(FRAC_PI_4_LREAL) - LREAL#1.0; + a := TAN(PI_LREAL); END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -357,7 +357,7 @@ fn atan_called_on_real() { VAR a,b : REAL; END_VAR - a := ATAN(REAL#1.0) - FRAC_PI_4_REAL; + a := ATAN(REAL#1.0) - FRAC_PI_4_REAL; END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -373,7 +373,7 @@ fn atan_called_on_lreal() { VAR a,b : LREAL; END_VAR - a := ATAN(LREAL#1.0) - FRAC_PI_4_LREAL; + a := ATAN(LREAL#1.0) - FRAC_PI_4_LREAL; END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -389,8 +389,8 @@ fn atan2_called_on_real() { VAR a,b : REAL; END_VAR - a := ATAN2(REAL#-3.0, REAL#3.0) + FRAC_PI_4_REAL; - b := ATAN2(REAL#3.0, REAL#-3.0) - (REAL#3.0 * FRAC_PI_4_REAL); + a := ATAN2(REAL#-3.0, REAL#3.0) + FRAC_PI_4_REAL; + b := ATAN2(REAL#3.0, REAL#-3.0) - (REAL#3.0 * FRAC_PI_4_REAL); END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); @@ -407,8 +407,8 @@ fn atan2_called_on_lreal() { VAR a,b : LREAL; END_VAR - a := ATAN2(LREAL#-3.0, LREAL#3.0) + FRAC_PI_4_LREAL; - b := ATAN2(LREAL#3.0, LREAL#-3.0) - (REAL#3.0 * FRAC_PI_4_LREAL); + a := ATAN2(LREAL#-3.0, LREAL#3.0) + FRAC_PI_4_LREAL; + b := ATAN2(LREAL#3.0, LREAL#-3.0) - (REAL#3.0 * FRAC_PI_4_LREAL); END_PROGRAM "; let sources = add_std!(src, "arithmetic_functions.st"); diff --git a/libs/stdlib/tests/bistable_functionblocks_tests.rs b/libs/stdlib/tests/bistable_functionblocks_tests.rs index 7bc40267aa..5813d558cb 100644 --- a/libs/stdlib/tests/bistable_functionblocks_tests.rs +++ b/libs/stdlib/tests/bistable_functionblocks_tests.rs @@ -25,26 +25,26 @@ struct MainType { fn sr() { let prog = r#" PROGRAM main - VAR - sr_inst : SR; - t_t_t : BOOL; - t_t_f : BOOL; - t_f_t : BOOL; - t_f_f : BOOL; - f_t_t : BOOL; - f_t_f : BOOL; - f_f_t : BOOL; - f_f_f : BOOL; - END_VAR - sr_inst(SET1 := TRUE, RESET := TRUE, Q1 => t_t_f); (* Q is in default state, S and R are asserted -> Q goes high *) - sr_inst(SET1 := FALSE, RESET := TRUE, Q1 => f_t_t); (* Q is high, R is asserted -> Q goes low *) - sr_inst(SET1 := FALSE, RESET := FALSE, Q1 => f_f_f); (* Q is low, neither S nor R are asserted -> Q stays low*) - sr_inst(SET1 := TRUE, RESET := FALSE, Q1 => t_f_f); (* Q is low, S is asserted -> Q goes high *) - sr_inst(SET1 := TRUE, RESET := TRUE, Q1 => t_t_t); (* Q is high, S and R are asserted -> Q stays high *) - sr_inst(SET1 := TRUE, RESET := FALSE, Q1 => t_f_t); (* Q is high, S is asserted -> Q stays high *) - sr_inst(SET1 := FALSE, RESET := FALSE, Q1 => f_f_t); (* Q is high, neither S nor R are asserted -> Q stays high *) + VAR + sr_inst : SR; + t_t_t : BOOL; + t_t_f : BOOL; + t_f_t : BOOL; + t_f_f : BOOL; + f_t_t : BOOL; + f_t_f : BOOL; + f_f_t : BOOL; + f_f_f : BOOL; + END_VAR + sr_inst(SET1 := TRUE, RESET := TRUE, Q1 => t_t_f); (* Q is in default state, S and R are asserted -> Q goes high *) + sr_inst(SET1 := FALSE, RESET := TRUE, Q1 => f_t_t); (* Q is high, R is asserted -> Q goes low *) + sr_inst(SET1 := FALSE, RESET := FALSE, Q1 => f_f_f); (* Q is low, neither S nor R are asserted -> Q stays low*) + sr_inst(SET1 := TRUE, RESET := FALSE, Q1 => t_f_f); (* Q is low, S is asserted -> Q goes high *) + sr_inst(SET1 := TRUE, RESET := TRUE, Q1 => t_t_t); (* Q is high, S and R are asserted -> Q stays high *) + sr_inst(SET1 := TRUE, RESET := FALSE, Q1 => t_f_t); (* Q is high, S is asserted -> Q stays high *) + sr_inst(SET1 := FALSE, RESET := FALSE, Q1 => f_f_t); (* Q is high, neither S nor R are asserted -> Q stays high *) sr_inst(SET1 := FALSE, RESET := TRUE, Q1 => f_t_f); (* reset *) - sr_inst(SET1 := FALSE, RESET := TRUE, Q1 => f_t_f); (* Q is low, R is asserted -> Q stays low *) + sr_inst(SET1 := FALSE, RESET := TRUE, Q1 => f_t_f); (* Q is low, R is asserted -> Q stays low *) END_PROGRAM "#; @@ -67,17 +67,17 @@ fn sr() { fn rs() { let prog = r#" PROGRAM main - VAR - rs_inst : RS; - t_t_t : BOOL; - t_t_f : BOOL; - t_f_t : BOOL; - t_f_f : BOOL; - f_t_t : BOOL; - f_t_f : BOOL; - f_f_t : BOOL; - f_f_f : BOOL; - END_VAR + VAR + rs_inst : RS; + t_t_t : BOOL; + t_t_f : BOOL; + t_f_t : BOOL; + t_f_f : BOOL; + f_t_t : BOOL; + f_t_f : BOOL; + f_f_t : BOOL; + f_f_f : BOOL; + END_VAR rs_inst(SET := TRUE, RESET1 := TRUE, Q1 => t_t_f); (* Q is in default state, S and R are asserted -> Q stays low *) rs_inst(SET := FALSE, RESET1 := FALSE, Q1 => f_f_f); (* Q is low, neither S nor R are asserted -> Q stays low*) rs_inst(SET := TRUE, RESET1 := FALSE, Q1 => t_f_f); (* Q is low, S is asserted -> Q goes high *) diff --git a/libs/stdlib/tests/bit_conversion_tests.rs b/libs/stdlib/tests/bit_conversion_tests.rs index 4adc3d3aaa..7eb478fc77 100644 --- a/libs/stdlib/tests/bit_conversion_tests.rs +++ b/libs/stdlib/tests/bit_conversion_tests.rs @@ -51,25 +51,25 @@ struct BoolType { #[test] fn lword_to_dword() { let src = r" - TYPE myType : STRUCT - zero : DWORD; positive : DWORD; negative : DWORD; - max_overflow: DWORD; min_overflow: DWORD; - END_STRUCT END_TYPE - - VAR_GLOBAL - max : LWORD := 4294967295; - min : LWORD := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_DWORD(LWORD#0); - ret.positive := LWORD_TO_DWORD(LWORD#100); - ret.negative := LWORD_TO_DWORD(-1); - ret.max_overflow := LWORD_TO_DWORD(max+1); - ret.min_overflow := LWORD_TO_DWORD(min-1); + TYPE myType : STRUCT + zero : DWORD; positive : DWORD; negative : DWORD; + max_overflow: DWORD; min_overflow: DWORD; + END_STRUCT END_TYPE + + VAR_GLOBAL + max : LWORD := 4294967295; + min : LWORD := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_DWORD(LWORD#0); + ret.positive := LWORD_TO_DWORD(LWORD#100); + ret.negative := LWORD_TO_DWORD(-1); + ret.max_overflow := LWORD_TO_DWORD(max+1); + ret.min_overflow := LWORD_TO_DWORD(min-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -85,25 +85,25 @@ fn lword_to_dword() { #[test] fn lword_to_word() { let src = r" - TYPE myType : STRUCT - zero : WORD; positive : WORD; negative : WORD; - max_overflow: WORD; min_overflow: WORD; - END_STRUCT END_TYPE - - VAR_GLOBAL - max : LWORD := 65535; - min : LWORD := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_WORD(LWORD#0); - ret.positive := LWORD_TO_WORD(LWORD#100); - ret.negative := LWORD_TO_WORD(-1); - ret.max_overflow := LWORD_TO_WORD(max+1); - ret.min_overflow := LWORD_TO_WORD(min-1); + TYPE myType : STRUCT + zero : WORD; positive : WORD; negative : WORD; + max_overflow: WORD; min_overflow: WORD; + END_STRUCT END_TYPE + + VAR_GLOBAL + max : LWORD := 65535; + min : LWORD := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_WORD(LWORD#0); + ret.positive := LWORD_TO_WORD(LWORD#100); + ret.negative := LWORD_TO_WORD(-1); + ret.max_overflow := LWORD_TO_WORD(max+1); + ret.min_overflow := LWORD_TO_WORD(min-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -119,25 +119,25 @@ fn lword_to_word() { #[test] fn lword_to_byte() { let src = r" - TYPE myType : STRUCT - zero : BYTE; positive : BYTE; negative : BYTE; - max_overflow: BYTE; min_overflow: BYTE; - END_STRUCT END_TYPE - - VAR_GLOBAL - max : LWORD := 255; - min : LWORD := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_BYTE(LWORD#0); - ret.positive := LWORD_TO_BYTE(LWORD#100); - ret.negative := LWORD_TO_BYTE(-1); - ret.max_overflow := LWORD_TO_BYTE(max+1); - ret.min_overflow := LWORD_TO_BYTE(min-1); + TYPE myType : STRUCT + zero : BYTE; positive : BYTE; negative : BYTE; + max_overflow: BYTE; min_overflow: BYTE; + END_STRUCT END_TYPE + + VAR_GLOBAL + max : LWORD := 255; + min : LWORD := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_BYTE(LWORD#0); + ret.positive := LWORD_TO_BYTE(LWORD#100); + ret.negative := LWORD_TO_BYTE(-1); + ret.max_overflow := LWORD_TO_BYTE(max+1); + ret.min_overflow := LWORD_TO_BYTE(min-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -153,19 +153,19 @@ fn lword_to_byte() { #[test] fn lword_to_bool() { let src = r" - TYPE myType : STRUCT - true_ : BOOL; false_ : BOOL; - max_overflow : BOOL; min_overflow : BOOL; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.true_ := LWORD_TO_BOOL(LWORD#1); - ret.false_ := LWORD_TO_BOOL(LWORD#0); - ret.max_overflow := LWORD_TO_BOOL(LWORD#2); - ret.min_overflow := LWORD_TO_BOOL(-1); + TYPE myType : STRUCT + true_ : BOOL; false_ : BOOL; + max_overflow : BOOL; min_overflow : BOOL; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.true_ := LWORD_TO_BOOL(LWORD#1); + ret.false_ := LWORD_TO_BOOL(LWORD#0); + ret.max_overflow := LWORD_TO_BOOL(LWORD#2); + ret.min_overflow := LWORD_TO_BOOL(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -180,17 +180,17 @@ fn lword_to_bool() { #[test] fn dword_to_lword() { let src = r" - TYPE myType : STRUCT - zero : LWORD; positive : LWORD; negative : LWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_LWORD(DWORD#0); - ret.positive := DWORD_TO_LWORD(DWORD#100); - ret.negative := DWORD_TO_LWORD(-1); + TYPE myType : STRUCT + zero : LWORD; positive : LWORD; negative : LWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_LWORD(DWORD#0); + ret.positive := DWORD_TO_LWORD(DWORD#100); + ret.negative := DWORD_TO_LWORD(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -204,25 +204,25 @@ fn dword_to_lword() { #[test] fn dword_to_word() { let src = r" - TYPE myType : STRUCT - zero : WORD; positive : WORD; negative : WORD; - max_overflow: WORD; min_overflow: WORD; - END_STRUCT END_TYPE - - VAR_GLOBAL - max : DWORD := 65535; - min : DWORD := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_WORD(DWORD#0); - ret.positive := DWORD_TO_WORD(DWORD#100); - ret.negative := DWORD_TO_WORD(-1); - ret.max_overflow := DWORD_TO_WORD(max+1); - ret.min_overflow := DWORD_TO_WORD(min-1); + TYPE myType : STRUCT + zero : WORD; positive : WORD; negative : WORD; + max_overflow: WORD; min_overflow: WORD; + END_STRUCT END_TYPE + + VAR_GLOBAL + max : DWORD := 65535; + min : DWORD := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_WORD(DWORD#0); + ret.positive := DWORD_TO_WORD(DWORD#100); + ret.negative := DWORD_TO_WORD(-1); + ret.max_overflow := DWORD_TO_WORD(max+1); + ret.min_overflow := DWORD_TO_WORD(min-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -238,25 +238,25 @@ fn dword_to_word() { #[test] fn dword_to_byte() { let src = r" - TYPE myType : STRUCT - zero : BYTE; positive : BYTE; negative : BYTE; - max_overflow: BYTE; min_overflow: BYTE; - END_STRUCT END_TYPE - - VAR_GLOBAL - max : DWORD := 255; - min : DWORD := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_BYTE(DWORD#0); - ret.positive := DWORD_TO_BYTE(DWORD#100); - ret.negative := DWORD_TO_BYTE(-1); - ret.max_overflow := DWORD_TO_BYTE(max+1); - ret.min_overflow := DWORD_TO_BYTE(min-1); + TYPE myType : STRUCT + zero : BYTE; positive : BYTE; negative : BYTE; + max_overflow: BYTE; min_overflow: BYTE; + END_STRUCT END_TYPE + + VAR_GLOBAL + max : DWORD := 255; + min : DWORD := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_BYTE(DWORD#0); + ret.positive := DWORD_TO_BYTE(DWORD#100); + ret.negative := DWORD_TO_BYTE(-1); + ret.max_overflow := DWORD_TO_BYTE(max+1); + ret.min_overflow := DWORD_TO_BYTE(min-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -272,19 +272,19 @@ fn dword_to_byte() { #[test] fn dword_to_bool() { let src = r" - TYPE myType : STRUCT - true_ : BOOL; false_ : BOOL; - max_overflow : BOOL; min_overflow : BOOL; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.true_ := DWORD_TO_BOOL(DWORD#1); - ret.false_ := DWORD_TO_BOOL(DWORD#0); - ret.max_overflow := DWORD_TO_BOOL(DWORD#2); - ret.min_overflow := DWORD_TO_BOOL(-1); + TYPE myType : STRUCT + true_ : BOOL; false_ : BOOL; + max_overflow : BOOL; min_overflow : BOOL; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.true_ := DWORD_TO_BOOL(DWORD#1); + ret.false_ := DWORD_TO_BOOL(DWORD#0); + ret.max_overflow := DWORD_TO_BOOL(DWORD#2); + ret.min_overflow := DWORD_TO_BOOL(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -299,17 +299,17 @@ fn dword_to_bool() { #[test] fn word_to_lword() { let src = r" - TYPE myType : STRUCT - zero : LWORD; positive : LWORD; negative : LWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_LWORD(WORD#0); - ret.positive := WORD_TO_LWORD(WORD#100); - ret.negative := WORD_TO_LWORD(-1); + TYPE myType : STRUCT + zero : LWORD; positive : LWORD; negative : LWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_LWORD(WORD#0); + ret.positive := WORD_TO_LWORD(WORD#100); + ret.negative := WORD_TO_LWORD(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -323,17 +323,17 @@ fn word_to_lword() { #[test] fn word_to_dword() { let src = r" - TYPE myType : STRUCT - zero : DWORD; positive : DWORD; negative : DWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_DWORD(WORD#0); - ret.positive := WORD_TO_DWORD(WORD#100); - ret.negative := WORD_TO_DWORD(-1); + TYPE myType : STRUCT + zero : DWORD; positive : DWORD; negative : DWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_DWORD(WORD#0); + ret.positive := WORD_TO_DWORD(WORD#100); + ret.negative := WORD_TO_DWORD(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -347,25 +347,25 @@ fn word_to_dword() { #[test] fn word_to_byte() { let src = r" - TYPE myType : STRUCT - zero : BYTE; positive : BYTE; negative : BYTE; - max_overflow: BYTE; min_overflow: BYTE; - END_STRUCT END_TYPE - - VAR_GLOBAL - max : WORD := 255; - min : WORD := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_BYTE(WORD#0); - ret.positive := WORD_TO_BYTE(WORD#100); - ret.negative := WORD_TO_BYTE(-1); - ret.max_overflow := WORD_TO_BYTE(max+1); - ret.min_overflow := WORD_TO_BYTE(min-1); + TYPE myType : STRUCT + zero : BYTE; positive : BYTE; negative : BYTE; + max_overflow: BYTE; min_overflow: BYTE; + END_STRUCT END_TYPE + + VAR_GLOBAL + max : WORD := 255; + min : WORD := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_BYTE(WORD#0); + ret.positive := WORD_TO_BYTE(WORD#100); + ret.negative := WORD_TO_BYTE(-1); + ret.max_overflow := WORD_TO_BYTE(max+1); + ret.min_overflow := WORD_TO_BYTE(min-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -381,19 +381,19 @@ fn word_to_byte() { #[test] fn word_to_bool() { let src = r" - TYPE myType : STRUCT - true_ : BOOL; false_ : BOOL; - max_overflow : BOOL; min_overflow : BOOL; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.true_ := WORD_TO_BOOL(WORD#1); - ret.false_ := WORD_TO_BOOL(WORD#0); - ret.max_overflow := WORD_TO_BOOL(WORD#2); - ret.min_overflow := WORD_TO_BOOL(-1); + TYPE myType : STRUCT + true_ : BOOL; false_ : BOOL; + max_overflow : BOOL; min_overflow : BOOL; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.true_ := WORD_TO_BOOL(WORD#1); + ret.false_ := WORD_TO_BOOL(WORD#0); + ret.max_overflow := WORD_TO_BOOL(WORD#2); + ret.min_overflow := WORD_TO_BOOL(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -408,17 +408,17 @@ fn word_to_bool() { #[test] fn byte_to_lword() { let src = r" - TYPE myType : STRUCT - zero : LWORD; positive : LWORD; negative : LWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_LWORD(BYTE#0); - ret.positive := BYTE_TO_LWORD(BYTE#100); - ret.negative := BYTE_TO_LWORD(-1); + TYPE myType : STRUCT + zero : LWORD; positive : LWORD; negative : LWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_LWORD(BYTE#0); + ret.positive := BYTE_TO_LWORD(BYTE#100); + ret.negative := BYTE_TO_LWORD(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -432,17 +432,17 @@ fn byte_to_lword() { #[test] fn byte_to_dword() { let src = r" - TYPE myType : STRUCT - zero : DWORD; positive : DWORD; negative : DWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_DWORD(BYTE#0); - ret.positive := BYTE_TO_DWORD(BYTE#100); - ret.negative := BYTE_TO_DWORD(-1); + TYPE myType : STRUCT + zero : DWORD; positive : DWORD; negative : DWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_DWORD(BYTE#0); + ret.positive := BYTE_TO_DWORD(BYTE#100); + ret.negative := BYTE_TO_DWORD(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -456,17 +456,17 @@ fn byte_to_dword() { #[test] fn byte_to_word() { let src = r" - TYPE myType : STRUCT - zero : WORD; positive : WORD; negative : WORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_WORD(BYTE#0); - ret.positive := BYTE_TO_WORD(BYTE#100); - ret.negative := BYTE_TO_WORD(-1); + TYPE myType : STRUCT + zero : WORD; positive : WORD; negative : WORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_WORD(BYTE#0); + ret.positive := BYTE_TO_WORD(BYTE#100); + ret.negative := BYTE_TO_WORD(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -480,19 +480,19 @@ fn byte_to_word() { #[test] fn byte_to_bool() { let src = r" - TYPE myType : STRUCT - true_ : BOOL; false_ : BOOL; - max_overflow : BOOL; min_overflow : BOOL; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.true_ := BYTE_TO_BOOL(BYTE#1); - ret.false_ := BYTE_TO_BOOL(BYTE#0); - ret.max_overflow := BYTE_TO_BOOL(BYTE#2); - ret.min_overflow := BYTE_TO_BOOL(-1); + TYPE myType : STRUCT + true_ : BOOL; false_ : BOOL; + max_overflow : BOOL; min_overflow : BOOL; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.true_ := BYTE_TO_BOOL(BYTE#1); + ret.false_ := BYTE_TO_BOOL(BYTE#0); + ret.max_overflow := BYTE_TO_BOOL(BYTE#2); + ret.min_overflow := BYTE_TO_BOOL(-1); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -514,15 +514,15 @@ fn byte_to_char() { } let src = r" - PROGRAM main - VAR - a : CHAR; - b : CHAR; - c : CHAR; - END_VAR - a := BYTE_TO_CHAR(BYTE#97); - b := BYTE_TO_CHAR(BYTE#98); - c := BYTE_TO_CHAR(BYTE#99); + PROGRAM main + VAR + a : CHAR; + b : CHAR; + c : CHAR; + END_VAR + a := BYTE_TO_CHAR(BYTE#97); + b := BYTE_TO_CHAR(BYTE#98); + c := BYTE_TO_CHAR(BYTE#99); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -536,19 +536,19 @@ fn byte_to_char() { #[test] fn bool_to_lword() { let src = r" - TYPE myType : STRUCT - zero : LWORD; positive : LWORD; negative : LWORD; - max_overflow : LWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_LWORD(BOOL#0); - ret.positive := BOOL_TO_LWORD(BOOL#1); - ret.negative := BOOL_TO_LWORD(-1); - ret.max_overflow := BOOL_TO_LWORD(10); + TYPE myType : STRUCT + zero : LWORD; positive : LWORD; negative : LWORD; + max_overflow : LWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_LWORD(BOOL#0); + ret.positive := BOOL_TO_LWORD(BOOL#1); + ret.negative := BOOL_TO_LWORD(-1); + ret.max_overflow := BOOL_TO_LWORD(10); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -563,19 +563,19 @@ fn bool_to_lword() { #[test] fn bool_to_dword() { let src = r" - TYPE myType : STRUCT - zero : DWORD; positive : DWORD; negative : DWORD; - max_overflow : DWORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_DWORD(BOOL#0); - ret.positive := BOOL_TO_DWORD(BOOL#1); - ret.negative := BOOL_TO_DWORD(-1); - ret.max_overflow := BOOL_TO_DWORD(10); + TYPE myType : STRUCT + zero : DWORD; positive : DWORD; negative : DWORD; + max_overflow : DWORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_DWORD(BOOL#0); + ret.positive := BOOL_TO_DWORD(BOOL#1); + ret.negative := BOOL_TO_DWORD(-1); + ret.max_overflow := BOOL_TO_DWORD(10); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -590,19 +590,19 @@ fn bool_to_dword() { #[test] fn bool_to_word() { let src = r" - TYPE myType : STRUCT - zero : WORD; positive : WORD; negative : WORD; - max_overflow : WORD; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_WORD(BOOL#0); - ret.positive := BOOL_TO_WORD(BOOL#1); - ret.negative := BOOL_TO_WORD(-1); - ret.max_overflow := BOOL_TO_WORD(10); + TYPE myType : STRUCT + zero : WORD; positive : WORD; negative : WORD; + max_overflow : WORD; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_WORD(BOOL#0); + ret.positive := BOOL_TO_WORD(BOOL#1); + ret.negative := BOOL_TO_WORD(-1); + ret.max_overflow := BOOL_TO_WORD(10); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -617,19 +617,19 @@ fn bool_to_word() { #[test] fn bool_to_byte() { let src = r" - TYPE myType : STRUCT - zero : BYTE; positive : BYTE; negative : BYTE; - max_overflow : BYTE; - END_STRUCT END_TYPE - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_BYTE(BOOL#0); - ret.positive := BOOL_TO_BYTE(BOOL#1); - ret.negative := BOOL_TO_BYTE(-1); - ret.max_overflow := BOOL_TO_BYTE(10); + TYPE myType : STRUCT + zero : BYTE; positive : BYTE; negative : BYTE; + max_overflow : BYTE; + END_STRUCT END_TYPE + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_BYTE(BOOL#0); + ret.positive := BOOL_TO_BYTE(BOOL#1); + ret.negative := BOOL_TO_BYTE(-1); + ret.max_overflow := BOOL_TO_BYTE(10); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -651,15 +651,15 @@ fn char_to_byte() { } let src = r" - PROGRAM main - VAR - a : BYTE; - b : BYTE; - c : BYTE; - END_VAR - a := CHAR_TO_BYTE(CHAR#'a'); - b := CHAR_TO_BYTE(CHAR#'b'); - c := CHAR_TO_BYTE(CHAR#'c'); + PROGRAM main + VAR + a : BYTE; + b : BYTE; + c : BYTE; + END_VAR + a := CHAR_TO_BYTE(CHAR#'a'); + b := CHAR_TO_BYTE(CHAR#'b'); + c := CHAR_TO_BYTE(CHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -680,15 +680,15 @@ fn char_to_word() { } let src = r" - PROGRAM main - VAR - a : WORD; - b : WORD; - c : WORD; - END_VAR - a := CHAR_TO_WORD(CHAR#'a'); - b := CHAR_TO_WORD(CHAR#'b'); - c := CHAR_TO_WORD(CHAR#'c'); + PROGRAM main + VAR + a : WORD; + b : WORD; + c : WORD; + END_VAR + a := CHAR_TO_WORD(CHAR#'a'); + b := CHAR_TO_WORD(CHAR#'b'); + c := CHAR_TO_WORD(CHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -709,15 +709,15 @@ fn char_to_dword() { } let src = r" - PROGRAM main - VAR - a : DWORD; - b : DWORD; - c : DWORD; - END_VAR - a := CHAR_TO_DWORD(CHAR#'a'); - b := CHAR_TO_DWORD(CHAR#'b'); - c := CHAR_TO_DWORD(CHAR#'c'); + PROGRAM main + VAR + a : DWORD; + b : DWORD; + c : DWORD; + END_VAR + a := CHAR_TO_DWORD(CHAR#'a'); + b := CHAR_TO_DWORD(CHAR#'b'); + c := CHAR_TO_DWORD(CHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -738,15 +738,15 @@ fn char_to_lword() { } let src = r" - PROGRAM main - VAR - a : LWORD; - b : LWORD; - c : LWORD; - END_VAR - a := CHAR_TO_LWORD(CHAR#'a'); - b := CHAR_TO_LWORD(CHAR#'b'); - c := CHAR_TO_LWORD(CHAR#'c'); + PROGRAM main + VAR + a : LWORD; + b : LWORD; + c : LWORD; + END_VAR + a := CHAR_TO_LWORD(CHAR#'a'); + b := CHAR_TO_LWORD(CHAR#'b'); + c := CHAR_TO_LWORD(CHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -767,15 +767,15 @@ fn wchar_to_word() { } let src = r" - PROGRAM main - VAR - a : WORD; - b : WORD; - c : WORD; - END_VAR - a := WCHAR_TO_WORD(WCHAR#'a'); - b := WCHAR_TO_WORD(WCHAR#'b'); - c := WCHAR_TO_WORD(WCHAR#'c'); + PROGRAM main + VAR + a : WORD; + b : WORD; + c : WORD; + END_VAR + a := WCHAR_TO_WORD(WCHAR#'a'); + b := WCHAR_TO_WORD(WCHAR#'b'); + c := WCHAR_TO_WORD(WCHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -796,15 +796,15 @@ fn wchar_to_dword() { } let src = r" - PROGRAM main - VAR - a : DWORD; - b : DWORD; - c : DWORD; - END_VAR - a := WCHAR_TO_DWORD(WCHAR#'a'); - b := WCHAR_TO_DWORD(WCHAR#'b'); - c := WCHAR_TO_DWORD(WCHAR#'c'); + PROGRAM main + VAR + a : DWORD; + b : DWORD; + c : DWORD; + END_VAR + a := WCHAR_TO_DWORD(WCHAR#'a'); + b := WCHAR_TO_DWORD(WCHAR#'b'); + c := WCHAR_TO_DWORD(WCHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); @@ -825,15 +825,15 @@ fn wchar_to_lword() { } let src = r" - PROGRAM main - VAR - a : LWORD; - b : LWORD; - c : LWORD; - END_VAR - a := WCHAR_TO_LWORD(WCHAR#'a'); - b := WCHAR_TO_LWORD(WCHAR#'b'); - c := WCHAR_TO_LWORD(WCHAR#'c'); + PROGRAM main + VAR + a : LWORD; + b : LWORD; + c : LWORD; + END_VAR + a := WCHAR_TO_LWORD(WCHAR#'a'); + b := WCHAR_TO_LWORD(WCHAR#'b'); + c := WCHAR_TO_LWORD(WCHAR#'c'); END_PROGRAM "; let sources = add_std!(src, "bit_conversion.st"); diff --git a/libs/stdlib/tests/bit_num_conversion_tests.rs b/libs/stdlib/tests/bit_num_conversion_tests.rs index 64814e5d2c..b67fac7512 100644 --- a/libs/stdlib/tests/bit_num_conversion_tests.rs +++ b/libs/stdlib/tests/bit_num_conversion_tests.rs @@ -70,17 +70,17 @@ struct U8Type { #[test] fn lword_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; max : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; max : LREAL; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_LREAL(LWORD#0); - // bit transfer for conversion 4611686018427387904 should be the first bit from the exponent resulting in decimal 2 - ret.max := LWORD_TO_LREAL(LWORD#4611686018427387904); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_LREAL(LWORD#0); + // bit transfer for conversion 4611686018427387904 should be the first bit from the exponent resulting in decimal 2 + ret.max := LWORD_TO_LREAL(LWORD#4611686018427387904); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -93,16 +93,16 @@ fn lword_to_lreal_conversion() { #[test] fn lword_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; max : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; max : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_LINT(LWORD#0); - ret.max := LWORD_TO_LINT(LWORD#9223372036854775807); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_LINT(LWORD#0); + ret.max := LWORD_TO_LINT(LWORD#9223372036854775807); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -115,16 +115,16 @@ fn lword_to_lint_conversion() { #[test] fn lword_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; max : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; max : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_DINT(LWORD#0); - ret.max := LWORD_TO_DINT(LWORD#2147483647); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_DINT(LWORD#0); + ret.max := LWORD_TO_DINT(LWORD#2147483647); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -137,16 +137,16 @@ fn lword_to_dint_conversion() { #[test] fn lword_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; max : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; max : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_INT(LWORD#0); - ret.max := LWORD_TO_INT(LWORD#32767); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_INT(LWORD#0); + ret.max := LWORD_TO_INT(LWORD#32767); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -159,16 +159,16 @@ fn lword_to_int_conversion() { #[test] fn lword_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; max : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; max : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_SINT(LWORD#0); - ret.max := LWORD_TO_SINT(LWORD#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_SINT(LWORD#0); + ret.max := LWORD_TO_SINT(LWORD#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -181,16 +181,16 @@ fn lword_to_sint_conversion() { #[test] fn lword_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; max : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; max : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_ULINT(LWORD#0); - ret.max := LWORD_TO_ULINT(LWORD#18446744073709551615); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_ULINT(LWORD#0); + ret.max := LWORD_TO_ULINT(LWORD#18446744073709551615); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -203,16 +203,16 @@ fn lword_to_ulint_conversion() { #[test] fn lword_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; max : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; max : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_UDINT(LWORD#0); - ret.max := LWORD_TO_UDINT(LWORD#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_UDINT(LWORD#0); + ret.max := LWORD_TO_UDINT(LWORD#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -225,16 +225,16 @@ fn lword_to_udint_conversion() { #[test] fn lword_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; max : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; max : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_UINT(LWORD#0); - ret.max := LWORD_TO_UINT(LWORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_UINT(LWORD#0); + ret.max := LWORD_TO_UINT(LWORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -247,16 +247,16 @@ fn lword_to_uint_conversion() { #[test] fn lword_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; max : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; max : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LWORD_TO_USINT(LWORD#0); - ret.max := LWORD_TO_USINT(LWORD#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LWORD_TO_USINT(LWORD#0); + ret.max := LWORD_TO_USINT(LWORD#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -269,17 +269,17 @@ fn lword_to_usint_conversion() { #[test] fn dword_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; max : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; max : REAL; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_REAL(DWORD#0); - // bit transfer for conversion 1073741824 should be the first bit from the exponent resulting in decimal 2 - ret.max := DWORD_TO_REAL(DWORD#1073741824); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_REAL(DWORD#0); + // bit transfer for conversion 1073741824 should be the first bit from the exponent resulting in decimal 2 + ret.max := DWORD_TO_REAL(DWORD#1073741824); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -292,16 +292,16 @@ fn dword_to_real_conversion() { #[test] fn dword_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; max : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; max : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_LINT(DWORD#0); - ret.max := DWORD_TO_LINT(DWORD#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_LINT(DWORD#0); + ret.max := DWORD_TO_LINT(DWORD#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -314,18 +314,18 @@ fn dword_to_lint_conversion() { #[test] fn dword_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; max : DINT; max_overflow : DINT; negative : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; max : DINT; max_overflow : DINT; negative : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_DINT(DWORD#0); - ret.max := DWORD_TO_DINT(DWORD#2147483647); - ret.max_overflow := DWORD_TO_DINT(DWORD#4294967295); - ret.negative := DWORD_TO_DINT(-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_DINT(DWORD#0); + ret.max := DWORD_TO_DINT(DWORD#2147483647); + ret.max_overflow := DWORD_TO_DINT(DWORD#4294967295); + ret.negative := DWORD_TO_DINT(-1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -340,16 +340,16 @@ fn dword_to_dint_conversion() { #[test] fn dword_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; max : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; max : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_INT(DWORD#0); - ret.max := DWORD_TO_INT(DWORD#32767); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_INT(DWORD#0); + ret.max := DWORD_TO_INT(DWORD#32767); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -362,16 +362,16 @@ fn dword_to_int_conversion() { #[test] fn dword_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; max : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; max : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_SINT(DWORD#0); - ret.max := DWORD_TO_SINT(DWORD#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_SINT(DWORD#0); + ret.max := DWORD_TO_SINT(DWORD#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -384,16 +384,16 @@ fn dword_to_sint_conversion() { #[test] fn dword_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; max : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; max : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_ULINT(DWORD#0); - ret.max := DWORD_TO_ULINT(DWORD#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_ULINT(DWORD#0); + ret.max := DWORD_TO_ULINT(DWORD#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -406,16 +406,16 @@ fn dword_to_ulint_conversion() { #[test] fn dword_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; max : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; max : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_UDINT(DWORD#0); - ret.max := DWORD_TO_UDINT(DWORD#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_UDINT(DWORD#0); + ret.max := DWORD_TO_UDINT(DWORD#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -428,16 +428,16 @@ fn dword_to_udint_conversion() { #[test] fn dword_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; max : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; max : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_UINT(DWORD#0); - ret.max := DWORD_TO_UINT(DWORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_UINT(DWORD#0); + ret.max := DWORD_TO_UINT(DWORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -450,16 +450,16 @@ fn dword_to_uint_conversion() { #[test] fn dword_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; max : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; max : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DWORD_TO_USINT(DWORD#0); - ret.max := DWORD_TO_USINT(DWORD#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DWORD_TO_USINT(DWORD#0); + ret.max := DWORD_TO_USINT(DWORD#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -472,16 +472,16 @@ fn dword_to_usint_conversion() { #[test] fn word_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; max : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; max : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_LINT(WORD#0); - ret.max := WORD_TO_LINT(WORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_LINT(WORD#0); + ret.max := WORD_TO_LINT(WORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -494,16 +494,16 @@ fn word_to_lint_conversion() { #[test] fn word_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; max : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; max : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_DINT(WORD#0); - ret.max := WORD_TO_DINT(WORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_DINT(WORD#0); + ret.max := WORD_TO_DINT(WORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -516,16 +516,16 @@ fn word_to_dint_conversion() { #[test] fn word_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; max : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; max : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_INT(WORD#0); - ret.max := WORD_TO_INT(WORD#32767); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_INT(WORD#0); + ret.max := WORD_TO_INT(WORD#32767); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -538,16 +538,16 @@ fn word_to_int_conversion() { #[test] fn word_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; max : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; max : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_SINT(WORD#0); - ret.max := WORD_TO_SINT(WORD#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_SINT(WORD#0); + ret.max := WORD_TO_SINT(WORD#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -560,16 +560,16 @@ fn word_to_sint_conversion() { #[test] fn word_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; max : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; max : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_ULINT(WORD#0); - ret.max := WORD_TO_ULINT(WORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_ULINT(WORD#0); + ret.max := WORD_TO_ULINT(WORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -582,16 +582,16 @@ fn word_to_ulint_conversion() { #[test] fn word_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; max : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; max : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_UDINT(WORD#0); - ret.max := WORD_TO_UDINT(WORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_UDINT(WORD#0); + ret.max := WORD_TO_UDINT(WORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -604,16 +604,16 @@ fn word_to_udint_conversion() { #[test] fn word_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; max : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; max : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_UINT(WORD#0); - ret.max := WORD_TO_UINT(WORD#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_UINT(WORD#0); + ret.max := WORD_TO_UINT(WORD#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -626,16 +626,16 @@ fn word_to_uint_conversion() { #[test] fn word_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; max : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; max : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := WORD_TO_USINT(WORD#0); - ret.max := WORD_TO_USINT(WORD#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := WORD_TO_USINT(WORD#0); + ret.max := WORD_TO_USINT(WORD#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -648,16 +648,16 @@ fn word_to_usint_conversion() { #[test] fn byte_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; max : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; max : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_LINT(BYTE#0); - ret.max := BYTE_TO_LINT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_LINT(BYTE#0); + ret.max := BYTE_TO_LINT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -670,16 +670,16 @@ fn byte_to_lint_conversion() { #[test] fn byte_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; max : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; max : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_DINT(BYTE#0); - ret.max := BYTE_TO_DINT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_DINT(BYTE#0); + ret.max := BYTE_TO_DINT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -692,16 +692,16 @@ fn byte_to_dint_conversion() { #[test] fn byte_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; max : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; max : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_INT(BYTE#0); - ret.max := BYTE_TO_INT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_INT(BYTE#0); + ret.max := BYTE_TO_INT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -714,16 +714,16 @@ fn byte_to_int_conversion() { #[test] fn byte_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; max : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; max : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_SINT(BYTE#0); - ret.max := BYTE_TO_SINT(BYTE#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_SINT(BYTE#0); + ret.max := BYTE_TO_SINT(BYTE#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -736,16 +736,16 @@ fn byte_to_sint_conversion() { #[test] fn byte_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; max : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; max : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_ULINT(BYTE#0); - ret.max := BYTE_TO_ULINT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_ULINT(BYTE#0); + ret.max := BYTE_TO_ULINT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -758,16 +758,16 @@ fn byte_to_ulint_conversion() { #[test] fn byte_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; max : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; max : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_UDINT(BYTE#0); - ret.max := BYTE_TO_UDINT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_UDINT(BYTE#0); + ret.max := BYTE_TO_UDINT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -780,16 +780,16 @@ fn byte_to_udint_conversion() { #[test] fn byte_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; max : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; max : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_UINT(BYTE#0); - ret.max := BYTE_TO_UINT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_UINT(BYTE#0); + ret.max := BYTE_TO_UINT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -802,16 +802,16 @@ fn byte_to_uint_conversion() { #[test] fn byte_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; max : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; max : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BYTE_TO_USINT(BYTE#0); - ret.max := BYTE_TO_USINT(BYTE#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BYTE_TO_USINT(BYTE#0); + ret.max := BYTE_TO_USINT(BYTE#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -824,16 +824,16 @@ fn byte_to_usint_conversion() { #[test] fn bool_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; max : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; max : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_LINT(BOOL#0); - ret.max := BOOL_TO_LINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_LINT(BOOL#0); + ret.max := BOOL_TO_LINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -846,16 +846,16 @@ fn bool_to_lint_conversion() { #[test] fn bool_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; max : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; max : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_DINT(BOOL#0); - ret.max := BOOL_TO_DINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_DINT(BOOL#0); + ret.max := BOOL_TO_DINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -868,16 +868,16 @@ fn bool_to_dint_conversion() { #[test] fn bool_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; max : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; max : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_INT(BOOL#0); - ret.max := BOOL_TO_INT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_INT(BOOL#0); + ret.max := BOOL_TO_INT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -890,16 +890,16 @@ fn bool_to_int_conversion() { #[test] fn bool_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; max : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; max : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_SINT(BOOL#0); - ret.max := BOOL_TO_SINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_SINT(BOOL#0); + ret.max := BOOL_TO_SINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -912,16 +912,16 @@ fn bool_to_sint_conversion() { #[test] fn bool_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; max : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; max : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_ULINT(BOOL#0); - ret.max := BOOL_TO_ULINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_ULINT(BOOL#0); + ret.max := BOOL_TO_ULINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -934,16 +934,16 @@ fn bool_to_ulint_conversion() { #[test] fn bool_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; max : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; max : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_UDINT(BOOL#0); - ret.max := BOOL_TO_UDINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_UDINT(BOOL#0); + ret.max := BOOL_TO_UDINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -956,16 +956,16 @@ fn bool_to_udint_conversion() { #[test] fn bool_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; max : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; max : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_UINT(BOOL#0); - ret.max := BOOL_TO_UINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_UINT(BOOL#0); + ret.max := BOOL_TO_UINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -978,16 +978,16 @@ fn bool_to_uint_conversion() { #[test] fn bool_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; max : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; max : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := BOOL_TO_USINT(BOOL#0); - ret.max := BOOL_TO_USINT(BOOL#1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := BOOL_TO_USINT(BOOL#0); + ret.max := BOOL_TO_USINT(BOOL#1); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1000,18 +1000,18 @@ fn bool_to_usint_conversion() { #[test] fn lreal_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_TO_LWORD(LREAL#0); - // counter test LWORD_TO_LREAL - // 2 in LREAL is the first bit from exponent 2^62 = 4611686018427387904 - ret.max := LREAL_TO_LWORD(LREAL#2); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_TO_LWORD(LREAL#0); + // counter test LWORD_TO_LREAL + // 2 in LREAL is the first bit from exponent 2^62 = 4611686018427387904 + ret.max := LREAL_TO_LWORD(LREAL#2); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1024,18 +1024,18 @@ fn lreal_to_lword_conversion() { #[test] fn real_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_TO_DWORD(REAL#0); - // counter test DWORD_TO_REAL - // 2 in REAL is the first bit from exponent 30 = 1073741824 - ret.max := REAL_TO_DWORD(REAL#2); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_TO_DWORD(REAL#0); + // counter test DWORD_TO_REAL + // 2 in REAL is the first bit from exponent 30 = 1073741824 + ret.max := REAL_TO_DWORD(REAL#2); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1048,16 +1048,16 @@ fn real_to_dword_conversion() { #[test] fn lint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_TO_LWORD(LINT#0); - ret.max := LINT_TO_LWORD(LINT#9223372036854775807); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_TO_LWORD(LINT#0); + ret.max := LINT_TO_LWORD(LINT#9223372036854775807); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1070,16 +1070,16 @@ fn lint_to_lword_conversion() { #[test] fn lint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_TO_DWORD(LINT#0); - ret.max := LINT_TO_DWORD(LINT#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_TO_DWORD(LINT#0); + ret.max := LINT_TO_DWORD(LINT#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1092,16 +1092,16 @@ fn lint_to_dword_conversion() { #[test] fn lint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_TO_WORD(LINT#0); - ret.max := LINT_TO_WORD(LINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_TO_WORD(LINT#0); + ret.max := LINT_TO_WORD(LINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1114,16 +1114,16 @@ fn lint_to_word_conversion() { #[test] fn lint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_TO_BYTE(LINT#0); - ret.max := LINT_TO_BYTE(LINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_TO_BYTE(LINT#0); + ret.max := LINT_TO_BYTE(LINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1136,16 +1136,16 @@ fn lint_to_byte_conversion() { #[test] fn dint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_TO_LWORD(DINT#0); - ret.max := DINT_TO_LWORD(DINT#2147483647); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_TO_LWORD(DINT#0); + ret.max := DINT_TO_LWORD(DINT#2147483647); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1158,16 +1158,16 @@ fn dint_to_lword_conversion() { #[test] fn dint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_TO_DWORD(DINT#0); - ret.max := DINT_TO_DWORD(DINT#2147483647); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_TO_DWORD(DINT#0); + ret.max := DINT_TO_DWORD(DINT#2147483647); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1180,16 +1180,16 @@ fn dint_to_dword_conversion() { #[test] fn dint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_TO_WORD(DINT#0); - ret.max := DINT_TO_WORD(DINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_TO_WORD(DINT#0); + ret.max := DINT_TO_WORD(DINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1202,16 +1202,16 @@ fn dint_to_word_conversion() { #[test] fn dint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_TO_BYTE(DINT#0); - ret.max := DINT_TO_BYTE(DINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_TO_BYTE(DINT#0); + ret.max := DINT_TO_BYTE(DINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1224,16 +1224,16 @@ fn dint_to_byte_conversion() { #[test] fn int_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_TO_LWORD(INT#0); - ret.max := INT_TO_LWORD(INT#32767); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_TO_LWORD(INT#0); + ret.max := INT_TO_LWORD(INT#32767); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1246,16 +1246,16 @@ fn int_to_lword_conversion() { #[test] fn int_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_TO_DWORD(INT#0); - ret.max := INT_TO_DWORD(INT#32767); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_TO_DWORD(INT#0); + ret.max := INT_TO_DWORD(INT#32767); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1268,16 +1268,16 @@ fn int_to_dword_conversion() { #[test] fn int_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_TO_WORD(INT#0); - ret.max := INT_TO_WORD(INT#32767); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_TO_WORD(INT#0); + ret.max := INT_TO_WORD(INT#32767); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1290,16 +1290,16 @@ fn int_to_word_conversion() { #[test] fn int_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_TO_BYTE(INT#0); - ret.max := INT_TO_BYTE(INT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_TO_BYTE(INT#0); + ret.max := INT_TO_BYTE(INT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1312,16 +1312,16 @@ fn int_to_byte_conversion() { #[test] fn sint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_TO_LWORD(SINT#0); - ret.max := SINT_TO_LWORD(SINT#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_TO_LWORD(SINT#0); + ret.max := SINT_TO_LWORD(SINT#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1334,16 +1334,16 @@ fn sint_to_lword_conversion() { #[test] fn sint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max :DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max :DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_TO_DWORD(SINT#0); - ret.max := SINT_TO_DWORD(SINT#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_TO_DWORD(SINT#0); + ret.max := SINT_TO_DWORD(SINT#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1356,16 +1356,16 @@ fn sint_to_dword_conversion() { #[test] fn sint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_TO_WORD(SINT#0); - ret.max := SINT_TO_WORD(SINT#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_TO_WORD(SINT#0); + ret.max := SINT_TO_WORD(SINT#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1378,16 +1378,16 @@ fn sint_to_word_conversion() { #[test] fn sint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_TO_BYTE(SINT#0); - ret.max := SINT_TO_BYTE(SINT#127); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_TO_BYTE(SINT#0); + ret.max := SINT_TO_BYTE(SINT#127); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1400,16 +1400,16 @@ fn sint_to_byte_conversion() { #[test] fn ulint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_TO_LWORD(ULINT#0); - ret.max := ULINT_TO_LWORD(ULINT#18446744073709551615); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_TO_LWORD(ULINT#0); + ret.max := ULINT_TO_LWORD(ULINT#18446744073709551615); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1422,16 +1422,16 @@ fn ulint_to_lword_conversion() { #[test] fn ulint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_TO_DWORD(ULINT#0); - ret.max := ULINT_TO_DWORD(ULINT#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_TO_DWORD(ULINT#0); + ret.max := ULINT_TO_DWORD(ULINT#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1444,16 +1444,16 @@ fn ulint_to_dword_conversion() { #[test] fn ulint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_TO_WORD(ULINT#0); - ret.max := ULINT_TO_WORD(ULINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_TO_WORD(ULINT#0); + ret.max := ULINT_TO_WORD(ULINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1466,16 +1466,16 @@ fn ulint_to_word_conversion() { #[test] fn ulint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_TO_BYTE(ULINT#0); - ret.max := ULINT_TO_BYTE(ULINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_TO_BYTE(ULINT#0); + ret.max := ULINT_TO_BYTE(ULINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1488,16 +1488,16 @@ fn ulint_to_byte_conversion() { #[test] fn udint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_TO_LWORD(UDINT#0); - ret.max := UDINT_TO_LWORD(UDINT#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_TO_LWORD(UDINT#0); + ret.max := UDINT_TO_LWORD(UDINT#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1510,16 +1510,16 @@ fn udint_to_lword_conversion() { #[test] fn udint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_TO_DWORD(UDINT#0); - ret.max := UDINT_TO_DWORD(UDINT#4294967295); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_TO_DWORD(UDINT#0); + ret.max := UDINT_TO_DWORD(UDINT#4294967295); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1532,16 +1532,16 @@ fn udint_to_dword_conversion() { #[test] fn udint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_TO_WORD(UDINT#0); - ret.max := UDINT_TO_WORD(UDINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_TO_WORD(UDINT#0); + ret.max := UDINT_TO_WORD(UDINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1554,16 +1554,16 @@ fn udint_to_word_conversion() { #[test] fn udint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_TO_BYTE(UDINT#0); - ret.max := UDINT_TO_BYTE(UDINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_TO_BYTE(UDINT#0); + ret.max := UDINT_TO_BYTE(UDINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1576,16 +1576,16 @@ fn udint_to_byte_conversion() { #[test] fn uint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_TO_LWORD(UINT#0); - ret.max := UINT_TO_LWORD(UINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_TO_LWORD(UINT#0); + ret.max := UINT_TO_LWORD(UINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1598,16 +1598,16 @@ fn uint_to_lword_conversion() { #[test] fn uint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_TO_DWORD(UINT#0); - ret.max := UINT_TO_DWORD(UINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_TO_DWORD(UINT#0); + ret.max := UINT_TO_DWORD(UINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1620,16 +1620,16 @@ fn uint_to_dword_conversion() { #[test] fn uint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_TO_WORD(UINT#0); - ret.max := UINT_TO_WORD(UINT#65535); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_TO_WORD(UINT#0); + ret.max := UINT_TO_WORD(UINT#65535); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1642,16 +1642,16 @@ fn uint_to_word_conversion() { #[test] fn uint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_TO_BYTE(UINT#0); - ret.max := UINT_TO_BYTE(UINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_TO_BYTE(UINT#0); + ret.max := UINT_TO_BYTE(UINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1664,16 +1664,16 @@ fn uint_to_byte_conversion() { #[test] fn usint_to_lword_conversion() { let src = r" - TYPE myType : STRUCT - zero : LWORD; max : LWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LWORD; max : LWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_TO_LWORD(USINT#0); - ret.max := USINT_TO_LWORD(USINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_TO_LWORD(USINT#0); + ret.max := USINT_TO_LWORD(USINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1686,16 +1686,16 @@ fn usint_to_lword_conversion() { #[test] fn usint_to_dword_conversion() { let src = r" - TYPE myType : STRUCT - zero : DWORD; max : DWORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DWORD; max : DWORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_TO_DWORD(USINT#0); - ret.max := USINT_TO_DWORD(USINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_TO_DWORD(USINT#0); + ret.max := USINT_TO_DWORD(USINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1708,16 +1708,16 @@ fn usint_to_dword_conversion() { #[test] fn usint_to_word_conversion() { let src = r" - TYPE myType : STRUCT - zero : WORD; max : WORD; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : WORD; max : WORD; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_TO_WORD(USINT#0); - ret.max := USINT_TO_WORD(USINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_TO_WORD(USINT#0); + ret.max := USINT_TO_WORD(USINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); @@ -1730,16 +1730,16 @@ fn usint_to_word_conversion() { #[test] fn usint_to_byte_conversion() { let src = r" - TYPE myType : STRUCT - zero : BYTE; max : BYTE; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : BYTE; max : BYTE; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_TO_BYTE(USINT#0); - ret.max := USINT_TO_BYTE(USINT#255); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_TO_BYTE(USINT#0); + ret.max := USINT_TO_BYTE(USINT#255); END_PROGRAM "; let sources = add_std!(src, "bit_num_conversion.st"); diff --git a/libs/stdlib/tests/counters_tests.rs b/libs/stdlib/tests/counters_tests.rs index a64f75171d..d9793768b7 100644 --- a/libs/stdlib/tests/counters_tests.rs +++ b/libs/stdlib/tests/counters_tests.rs @@ -21,19 +21,19 @@ struct CTUType { fn ctu() { let prog = r#" PROGRAM main - VAR - ctu_inst : CTU; - Q_res : BOOL; - CV_res : INT; - END_VAR - // count up until Q_res true and then reset CV_res - IF Q_res THEN - ctu_inst(CU:= TRUE, R:= TRUE, PV:= INT#3, Q:= Q_res, CV:= CV_res); - ELSE - ctu_inst(CU:= TRUE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); - // input CU evaluated by R_EDGE, this call will enable to count up again - ctu_inst(CU:= FALSE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); - END_IF + VAR + ctu_inst : CTU; + Q_res : BOOL; + CV_res : INT; + END_VAR + // count up until Q_res true and then reset CV_res + IF Q_res THEN + ctu_inst(CU:= TRUE, R:= TRUE, PV:= INT#3, Q:= Q_res, CV:= CV_res); + ELSE + ctu_inst(CU:= TRUE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); + // input CU evaluated by R_EDGE, this call will enable to count up again + ctu_inst(CU:= FALSE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); + END_IF END_PROGRAM "#; @@ -63,19 +63,19 @@ fn ctu() { fn ctu_int() { let prog = r#" PROGRAM main - VAR - ctu_inst : CTU_INT; - Q_res : BOOL; - CV_res : INT; - END_VAR - // count up until Q_res true and then reset CV_res - IF Q_res THEN - ctu_inst(CU:= TRUE, R:= TRUE, PV:= INT#3, Q:= Q_res, CV:= CV_res); - ELSE - ctu_inst(CU:= TRUE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); - // input CU evaluated by R_EDGE, this call will enable to count up again - ctu_inst(CU:= FALSE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); - END_IF + VAR + ctu_inst : CTU_INT; + Q_res : BOOL; + CV_res : INT; + END_VAR + // count up until Q_res true and then reset CV_res + IF Q_res THEN + ctu_inst(CU:= TRUE, R:= TRUE, PV:= INT#3, Q:= Q_res, CV:= CV_res); + ELSE + ctu_inst(CU:= TRUE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); + // input CU evaluated by R_EDGE, this call will enable to count up again + ctu_inst(CU:= FALSE, R:= FALSE, PV:= INT#3, Q:= Q_res, CV:= CV_res); + END_IF END_PROGRAM "#; @@ -105,19 +105,19 @@ fn ctu_int() { fn ctu_dint() { let prog = r#" PROGRAM main - VAR - ctu_inst : CTU_DINT; - Q_res : BOOL; - CV_res : DINT; - END_VAR - // count up until Q_res true and then reset CV_res - IF Q_res THEN - ctu_inst(CU:= TRUE, R:= TRUE, PV:= DINT#3, Q:= Q_res, CV:= CV_res); - ELSE - ctu_inst(CU:= TRUE, R:= FALSE, PV:= DINT#3, Q:= Q_res, CV:= CV_res); - // input CU evaluated by R_EDGE, this call will enable to count up again - ctu_inst(CU:= FALSE, R:= FALSE, PV:= DINT#3, Q:= Q_res, CV:= CV_res); - END_IF + VAR + ctu_inst : CTU_DINT; + Q_res : BOOL; + CV_res : DINT; + END_VAR + // count up until Q_res true and then reset CV_res + IF Q_res THEN + ctu_inst(CU:= TRUE, R:= TRUE, PV:= DINT#3, Q:= Q_res, CV:= CV_res); + ELSE + ctu_inst(CU:= TRUE, R:= FALSE, PV:= DINT#3, Q:= Q_res, CV:= CV_res); + // input CU evaluated by R_EDGE, this call will enable to count up again + ctu_inst(CU:= FALSE, R:= FALSE, PV:= DINT#3, Q:= Q_res, CV:= CV_res); + END_IF END_PROGRAM "#; @@ -147,19 +147,19 @@ fn ctu_dint() { fn ctu_udint() { let prog = r#" PROGRAM main - VAR - ctu_inst : CTU_UDINT; - Q_res : BOOL; - CV_res : UDINT; - END_VAR - // count up until Q_res true and then reset CV_res - IF Q_res THEN - ctu_inst(CU:= TRUE, R:= TRUE, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); - ELSE - ctu_inst(CU:= TRUE, R:= FALSE, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); - // input CU evaluated by R_EDGE, this call will enable to count up again - ctu_inst(CU:= FALSE, R:= FALSE, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); - END_IF + VAR + ctu_inst : CTU_UDINT; + Q_res : BOOL; + CV_res : UDINT; + END_VAR + // count up until Q_res true and then reset CV_res + IF Q_res THEN + ctu_inst(CU:= TRUE, R:= TRUE, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); + ELSE + ctu_inst(CU:= TRUE, R:= FALSE, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); + // input CU evaluated by R_EDGE, this call will enable to count up again + ctu_inst(CU:= FALSE, R:= FALSE, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); + END_IF END_PROGRAM "#; @@ -189,19 +189,19 @@ fn ctu_udint() { fn ctu_lint() { let prog = r#" PROGRAM main - VAR - ctu_inst : CTU_LINT; - Q_res : BOOL; - CV_res : LINT; - END_VAR - // count up until Q_res true and then reset CV_res - IF Q_res THEN - ctu_inst(CU:= TRUE, R:= TRUE, PV:= LINT#3, Q:= Q_res, CV:= CV_res); - ELSE - ctu_inst(CU:= TRUE, R:= FALSE, PV:= LINT#3, Q:= Q_res, CV:= CV_res); - // input CU evaluated by R_EDGE, this call will enable to count up again - ctu_inst(CU:= FALSE, R:= FALSE, PV:= LINT#3, Q:= Q_res, CV:= CV_res); - END_IF + VAR + ctu_inst : CTU_LINT; + Q_res : BOOL; + CV_res : LINT; + END_VAR + // count up until Q_res true and then reset CV_res + IF Q_res THEN + ctu_inst(CU:= TRUE, R:= TRUE, PV:= LINT#3, Q:= Q_res, CV:= CV_res); + ELSE + ctu_inst(CU:= TRUE, R:= FALSE, PV:= LINT#3, Q:= Q_res, CV:= CV_res); + // input CU evaluated by R_EDGE, this call will enable to count up again + ctu_inst(CU:= FALSE, R:= FALSE, PV:= LINT#3, Q:= Q_res, CV:= CV_res); + END_IF END_PROGRAM "#; @@ -231,19 +231,19 @@ fn ctu_lint() { fn ctu_ulint() { let prog = r#" PROGRAM main - VAR - ctu_inst : CTU_ULINT; - Q_res : BOOL; - CV_res : ULINT; - END_VAR - // count up until Q_res true and then reset CV_res - IF Q_res THEN - ctu_inst(CU:= TRUE, R:= TRUE, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); - ELSE - ctu_inst(CU:= TRUE, R:= FALSE, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); - // input CU evaluated by R_EDGE, this call will enable to count up again - ctu_inst(CU:= FALSE, R:= FALSE, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); - END_IF + VAR + ctu_inst : CTU_ULINT; + Q_res : BOOL; + CV_res : ULINT; + END_VAR + // count up until Q_res true and then reset CV_res + IF Q_res THEN + ctu_inst(CU:= TRUE, R:= TRUE, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); + ELSE + ctu_inst(CU:= TRUE, R:= FALSE, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); + // input CU evaluated by R_EDGE, this call will enable to count up again + ctu_inst(CU:= FALSE, R:= FALSE, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); + END_IF END_PROGRAM "#; @@ -282,20 +282,20 @@ struct CTDType { fn ctd() { let prog = r#" PROGRAM main - VAR - ctd_inst : CTD; - load : BOOL := TRUE; - Q_res : BOOL; - CV_res : INT; - END_VAR - // load PV value - IF load THEN - ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); - load := FALSE; - END_IF - ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); - // input CD evaluated by R_EDGE, this call will enable to count down again - ctd_inst(CD:= FALSE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); + VAR + ctd_inst : CTD; + load : BOOL := TRUE; + Q_res : BOOL; + CV_res : INT; + END_VAR + // load PV value + IF load THEN + ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); + load := FALSE; + END_IF + ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); + // input CD evaluated by R_EDGE, this call will enable to count down again + ctd_inst(CD:= FALSE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); END_PROGRAM "#; @@ -325,20 +325,20 @@ fn ctd() { fn ctd_int() { let prog = r#" PROGRAM main - VAR - ctd_inst : CTD_INT; - load : BOOL := TRUE; - Q_res : BOOL; - CV_res : INT; - END_VAR - // load PV value - IF load THEN - ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); - load := FALSE; - END_IF - ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); - // input CD evaluated by R_EDGE, this call will enable to count down again - ctd_inst(CD:= FALSE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); + VAR + ctd_inst : CTD_INT; + load : BOOL := TRUE; + Q_res : BOOL; + CV_res : INT; + END_VAR + // load PV value + IF load THEN + ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); + load := FALSE; + END_IF + ctd_inst(CD:= TRUE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); + // input CD evaluated by R_EDGE, this call will enable to count down again + ctd_inst(CD:= FALSE, LD:= load, PV:= INT#3, Q:= Q_res, CV:= CV_res); END_PROGRAM "#; @@ -368,20 +368,20 @@ fn ctd_int() { fn ctd_dint() { let prog = r#" PROGRAM main - VAR - ctd_inst : CTD_DINT; - load : BOOL := TRUE; - Q_res : BOOL; - CV_res : DINT; - END_VAR - // load PV value - IF load THEN - ctd_inst(CD:= TRUE, LD:= load, PV:= DINT#3, Q:= Q_res, CV:= CV_res); - load := FALSE; - END_IF - ctd_inst(CD:= TRUE, LD:= load, PV:= DINT#3, Q:= Q_res, CV:= CV_res); - // input CD evaluated by R_EDGE, this call will enable to count down again - ctd_inst(CD:= FALSE, LD:= load, PV:= DINT#3, Q:= Q_res, CV:= CV_res); + VAR + ctd_inst : CTD_DINT; + load : BOOL := TRUE; + Q_res : BOOL; + CV_res : DINT; + END_VAR + // load PV value + IF load THEN + ctd_inst(CD:= TRUE, LD:= load, PV:= DINT#3, Q:= Q_res, CV:= CV_res); + load := FALSE; + END_IF + ctd_inst(CD:= TRUE, LD:= load, PV:= DINT#3, Q:= Q_res, CV:= CV_res); + // input CD evaluated by R_EDGE, this call will enable to count down again + ctd_inst(CD:= FALSE, LD:= load, PV:= DINT#3, Q:= Q_res, CV:= CV_res); END_PROGRAM "#; @@ -411,20 +411,20 @@ fn ctd_dint() { fn ctd_udint() { let prog = r#" PROGRAM main - VAR - ctd_inst : CTD_UDINT; - load : BOOL := TRUE; - Q_res : BOOL; - CV_res : UDINT; - END_VAR - // load PV value - IF load THEN - ctd_inst(CD:= TRUE, LD:= load, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); - load := FALSE; - END_IF - ctd_inst(CD:= TRUE, LD:= load, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); - // input CD evaluated by R_EDGE, this call will enable to count down again - ctd_inst(CD:= FALSE, LD:= load, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); + VAR + ctd_inst : CTD_UDINT; + load : BOOL := TRUE; + Q_res : BOOL; + CV_res : UDINT; + END_VAR + // load PV value + IF load THEN + ctd_inst(CD:= TRUE, LD:= load, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); + load := FALSE; + END_IF + ctd_inst(CD:= TRUE, LD:= load, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); + // input CD evaluated by R_EDGE, this call will enable to count down again + ctd_inst(CD:= FALSE, LD:= load, PV:= UDINT#3, Q:= Q_res, CV:= CV_res); END_PROGRAM "#; @@ -454,20 +454,20 @@ fn ctd_udint() { fn ctd_lint() { let prog = r#" PROGRAM main - VAR - ctd_inst : CTD_LINT; - load : BOOL := TRUE; - Q_res : BOOL; - CV_res : LINT; - END_VAR - // load PV value - IF load THEN - ctd_inst(CD:= TRUE, LD:= load, PV:= LINT#3, Q:= Q_res, CV:= CV_res); - load := FALSE; - END_IF - ctd_inst(CD:= TRUE, LD:= load, PV:= LINT#3, Q:= Q_res, CV:= CV_res); - // input CD evaluated by R_EDGE, this call will enable to count down again - ctd_inst(CD:= FALSE, LD:= load, PV:= LINT#3, Q:= Q_res, CV:= CV_res); + VAR + ctd_inst : CTD_LINT; + load : BOOL := TRUE; + Q_res : BOOL; + CV_res : LINT; + END_VAR + // load PV value + IF load THEN + ctd_inst(CD:= TRUE, LD:= load, PV:= LINT#3, Q:= Q_res, CV:= CV_res); + load := FALSE; + END_IF + ctd_inst(CD:= TRUE, LD:= load, PV:= LINT#3, Q:= Q_res, CV:= CV_res); + // input CD evaluated by R_EDGE, this call will enable to count down again + ctd_inst(CD:= FALSE, LD:= load, PV:= LINT#3, Q:= Q_res, CV:= CV_res); END_PROGRAM "#; @@ -497,20 +497,20 @@ fn ctd_lint() { fn ctd_ulint() { let prog = r#" PROGRAM main - VAR - ctd_inst : CTD_ULINT; - load : BOOL := TRUE; - Q_res : BOOL; - CV_res : ULINT; - END_VAR - // load PV value - IF load THEN - ctd_inst(CD:= TRUE, LD:= load, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); - load := FALSE; - END_IF - ctd_inst(CD:= TRUE, LD:= load, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); - // input CD evaluated by R_EDGE, this call will enable to count down again - ctd_inst(CD:= FALSE, LD:= load, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); + VAR + ctd_inst : CTD_ULINT; + load : BOOL := TRUE; + Q_res : BOOL; + CV_res : ULINT; + END_VAR + // load PV value + IF load THEN + ctd_inst(CD:= TRUE, LD:= load, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); + load := FALSE; + END_IF + ctd_inst(CD:= TRUE, LD:= load, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); + // input CD evaluated by R_EDGE, this call will enable to count down again + ctd_inst(CD:= FALSE, LD:= load, PV:= ULINT#3, Q:= Q_res, CV:= CV_res); END_PROGRAM "#; @@ -551,43 +551,43 @@ struct CTUDType { fn ctud() { let prog = r#" PROGRAM main - VAR - ctud_inst : CTUD; - load : BOOL := TRUE; - QU_res : BOOL; - QD_res : BOOL; - CV_res : INT; - i : SINT; - END_VAR - // 1st call, load PV value - IF load THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - load := FALSE; - END_IF - - // 2nd call, CU/CD both true, nothing should happen - IF i = 1 THEN - ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 3rd call, count down - IF i = 2 THEN - // input CD evaluated by R_EDGE, this call will enable count down again - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 4th call, count up - IF i = 3 THEN - // input CU evaluated by R_EDGE, third call enabled count up again - ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 5th call, reset - IF i = 4 THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - i := i + 1; + VAR + ctud_inst : CTUD; + load : BOOL := TRUE; + QU_res : BOOL; + QD_res : BOOL; + CV_res : INT; + i : SINT; + END_VAR + // 1st call, load PV value + IF load THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + load := FALSE; + END_IF + + // 2nd call, CU/CD both true, nothing should happen + IF i = 1 THEN + ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 3rd call, count down + IF i = 2 THEN + // input CD evaluated by R_EDGE, this call will enable count down again + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 4th call, count up + IF i = 3 THEN + // input CU evaluated by R_EDGE, third call enabled count up again + ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 5th call, reset + IF i = 4 THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + i := i + 1; END_PROGRAM "#; @@ -626,43 +626,43 @@ fn ctud() { fn ctud_int() { let prog = r#" PROGRAM main - VAR - ctud_inst : CTUD_INT; - load : BOOL := TRUE; - QU_res : BOOL; - QD_res : BOOL; - CV_res : INT; - i : SINT; - END_VAR - // 1st call, load PV value - IF load THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - load := FALSE; - END_IF - - // 2nd call, CU/CD both true, nothing should happen - IF i = 1 THEN - ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 3rd call, count down - IF i = 2 THEN - // input CD evaluated by R_EDGE, this call will enable count down again - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 4th call, count up - IF i = 3 THEN - // input CU evaluated by R_EDGE, third call enabled count up again - ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 5th call, reset - IF i = 4 THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - i := i + 1; + VAR + ctud_inst : CTUD_INT; + load : BOOL := TRUE; + QU_res : BOOL; + QD_res : BOOL; + CV_res : INT; + i : SINT; + END_VAR + // 1st call, load PV value + IF load THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + load := FALSE; + END_IF + + // 2nd call, CU/CD both true, nothing should happen + IF i = 1 THEN + ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 3rd call, count down + IF i = 2 THEN + // input CD evaluated by R_EDGE, this call will enable count down again + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 4th call, count up + IF i = 3 THEN + // input CU evaluated by R_EDGE, third call enabled count up again + ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 5th call, reset + IF i = 4 THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= INT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + i := i + 1; END_PROGRAM "#; @@ -701,43 +701,43 @@ fn ctud_int() { fn ctud_dint() { let prog = r#" PROGRAM main - VAR - ctud_inst : CTUD_DINT; - load : BOOL := TRUE; - QU_res : BOOL; - QD_res : BOOL; - CV_res : DINT; - i : SINT; - END_VAR - // 1st call, load PV value - IF load THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - load := FALSE; - END_IF - - // 2nd call, CU/CD both true, nothing should happen - IF i = 1 THEN - ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 3rd call, count down - IF i = 2 THEN - // input CD evaluated by R_EDGE, this call will enable count down again - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 4th call, count up - IF i = 3 THEN - // input CU evaluated by R_EDGE, third call enabled count up again - ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 5th call, reset - IF i = 4 THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - i := i + 1; + VAR + ctud_inst : CTUD_DINT; + load : BOOL := TRUE; + QU_res : BOOL; + QD_res : BOOL; + CV_res : DINT; + i : SINT; + END_VAR + // 1st call, load PV value + IF load THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + load := FALSE; + END_IF + + // 2nd call, CU/CD both true, nothing should happen + IF i = 1 THEN + ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 3rd call, count down + IF i = 2 THEN + // input CD evaluated by R_EDGE, this call will enable count down again + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 4th call, count up + IF i = 3 THEN + // input CU evaluated by R_EDGE, third call enabled count up again + ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 5th call, reset + IF i = 4 THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= DINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + i := i + 1; END_PROGRAM "#; @@ -776,43 +776,43 @@ fn ctud_dint() { fn ctud_udint() { let prog = r#" PROGRAM main - VAR - ctud_inst : CTUD_UDINT; - load : BOOL := TRUE; - QU_res : BOOL; - QD_res : BOOL; - CV_res : UDINT; - i : SINT; - END_VAR - // 1st call, load PV value - IF load THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - load := FALSE; - END_IF - - // 2nd call, CU/CD both true, nothing should happen - IF i = 1 THEN - ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 3rd call, count down - IF i = 2 THEN - // input CD evaluated by R_EDGE, this call will enable count down again - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 4th call, count up - IF i = 3 THEN - // input CU evaluated by R_EDGE, third call enabled count up again - ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 5th call, reset - IF i = 4 THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - i := i + 1; + VAR + ctud_inst : CTUD_UDINT; + load : BOOL := TRUE; + QU_res : BOOL; + QD_res : BOOL; + CV_res : UDINT; + i : SINT; + END_VAR + // 1st call, load PV value + IF load THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + load := FALSE; + END_IF + + // 2nd call, CU/CD both true, nothing should happen + IF i = 1 THEN + ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 3rd call, count down + IF i = 2 THEN + // input CD evaluated by R_EDGE, this call will enable count down again + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 4th call, count up + IF i = 3 THEN + // input CU evaluated by R_EDGE, third call enabled count up again + ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 5th call, reset + IF i = 4 THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= UDINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + i := i + 1; END_PROGRAM "#; @@ -851,43 +851,43 @@ fn ctud_udint() { fn ctud_lint() { let prog = r#" PROGRAM main - VAR - ctud_inst : CTUD_LINT; - load : BOOL := TRUE; - QU_res : BOOL; - QD_res : BOOL; - CV_res : LINT; - i : SINT; - END_VAR - // 1st call, load PV value - IF load THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - load := FALSE; - END_IF - - // 2nd call, CU/CD both true, nothing should happen - IF i = 1 THEN - ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 3rd call, count down - IF i = 2 THEN - // input CD evaluated by R_EDGE, this call will enable count down again - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 4th call, count up - IF i = 3 THEN - // input CU evaluated by R_EDGE, third call enabled count up again - ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 5th call, reset - IF i = 4 THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - i := i + 1; + VAR + ctud_inst : CTUD_LINT; + load : BOOL := TRUE; + QU_res : BOOL; + QD_res : BOOL; + CV_res : LINT; + i : SINT; + END_VAR + // 1st call, load PV value + IF load THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + load := FALSE; + END_IF + + // 2nd call, CU/CD both true, nothing should happen + IF i = 1 THEN + ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 3rd call, count down + IF i = 2 THEN + // input CD evaluated by R_EDGE, this call will enable count down again + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 4th call, count up + IF i = 3 THEN + // input CU evaluated by R_EDGE, third call enabled count up again + ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 5th call, reset + IF i = 4 THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= LINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + i := i + 1; END_PROGRAM "#; @@ -926,43 +926,43 @@ fn ctud_lint() { fn ctud_ulint() { let prog = r#" PROGRAM main - VAR - ctud_inst : CTUD_ULINT; - load : BOOL := TRUE; - QU_res : BOOL; - QD_res : BOOL; - CV_res : ULINT; - i : SINT; - END_VAR - // 1st call, load PV value - IF load THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - load := FALSE; - END_IF - - // 2nd call, CU/CD both true, nothing should happen - IF i = 1 THEN - ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 3rd call, count down - IF i = 2 THEN - // input CD evaluated by R_EDGE, this call will enable count down again - ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 4th call, count up - IF i = 3 THEN - // input CU evaluated by R_EDGE, third call enabled count up again - ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - - // 5th call, reset - IF i = 4 THEN - ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); - END_IF - i := i + 1; + VAR + ctud_inst : CTUD_ULINT; + load : BOOL := TRUE; + QU_res : BOOL; + QD_res : BOOL; + CV_res : ULINT; + i : SINT; + END_VAR + // 1st call, load PV value + IF load THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= TRUE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + load := FALSE; + END_IF + + // 2nd call, CU/CD both true, nothing should happen + IF i = 1 THEN + ctud_inst(CU:= TRUE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 3rd call, count down + IF i = 2 THEN + // input CD evaluated by R_EDGE, this call will enable count down again + ctud_inst(CU:= FALSE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + ctud_inst(CU:= FALSE, CD:= TRUE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 4th call, count up + IF i = 3 THEN + // input CU evaluated by R_EDGE, third call enabled count up again + ctud_inst(CU:= TRUE, CD:= FALSE, R:= FALSE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + + // 5th call, reset + IF i = 4 THEN + ctud_inst(CU:= FALSE, CD:= FALSE, R:= TRUE, LD:= FALSE, PV:= ULINT#1, QU:= QU_res, QD:= QD_res, CV:= CV_res); + END_IF + i := i + 1; END_PROGRAM "#; diff --git a/libs/stdlib/tests/date_time_conversion_tests.rs b/libs/stdlib/tests/date_time_conversion_tests.rs index 292052b31d..0749bd8d32 100644 --- a/libs/stdlib/tests/date_time_conversion_tests.rs +++ b/libs/stdlib/tests/date_time_conversion_tests.rs @@ -20,9 +20,9 @@ impl Default for MainType { #[test] fn ltime_to_time_conversion() { let src = " - FUNCTION main : TIME - main := LTIME_TO_TIME(LTIME#10s); - END_FUNCTION"; + FUNCTION main : TIME + main := LTIME_TO_TIME(LTIME#10s); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -32,9 +32,9 @@ fn ltime_to_time_conversion() { #[test] fn time_to_ltime_conversion() { let src = " - FUNCTION main : LTIME - main := TIME_TO_LTIME(TIME#10s); - END_FUNCTION"; + FUNCTION main : LTIME + main := TIME_TO_LTIME(TIME#10s); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -44,9 +44,9 @@ fn time_to_ltime_conversion() { #[test] fn ldt_to_dt_conversion() { let src = " - FUNCTION main : DT - main := LDT_TO_DT(LDT#2021-04-20-22:33:14); - END_FUNCTION"; + FUNCTION main : DT + main := LDT_TO_DT(LDT#2021-04-20-22:33:14); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -63,9 +63,9 @@ fn ldt_to_dt_conversion() { #[test] fn ldt_to_date_conversion() { let src = " - FUNCTION main : DATE - main := LDT_TO_DATE(LDT#2000-01-01-20:15:11); - END_FUNCTION"; + FUNCTION main : DATE + main := LDT_TO_DATE(LDT#2000-01-01-20:15:11); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -78,9 +78,9 @@ fn ldt_to_date_conversion() { #[test] fn ldt_to_ltod_conversion() { let src = " - FUNCTION main : LTOD - main := LDT_TO_LTOD(LDT#2000-01-01-15:36:30.123456); - END_FUNCTION"; + FUNCTION main : LTOD + main := LDT_TO_LTOD(LDT#2000-01-01-15:36:30.123456); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -97,9 +97,9 @@ fn ldt_to_ltod_conversion() { #[test] fn ldt_to_tod_conversion() { let src = " - FUNCTION main : TOD - main := LDT_TO_TOD(LDT#2120-02-12-20:15:11.543); - END_FUNCTION"; + FUNCTION main : TOD + main := LDT_TO_TOD(LDT#2120-02-12-20:15:11.543); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -116,9 +116,9 @@ fn ldt_to_tod_conversion() { #[test] fn dt_to_ldt_conversion() { let src = " - FUNCTION main : LDT - main := DT_TO_LDT(DT#2021-04-20-22:33:14); - END_FUNCTION"; + FUNCTION main : LDT + main := DT_TO_LDT(DT#2021-04-20-22:33:14); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -135,9 +135,9 @@ fn dt_to_ldt_conversion() { #[test] fn dt_to_date_conversion() { let src = " - FUNCTION main : DATE - main := DT_TO_DATE(DT#2000-01-01-20:15:11); - END_FUNCTION"; + FUNCTION main : DATE + main := DT_TO_DATE(DT#2000-01-01-20:15:11); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -150,9 +150,9 @@ fn dt_to_date_conversion() { #[test] fn dt_to_ltod_conversion() { let src = " - FUNCTION main : LTOD - main := DT_TO_LTOD(DT#2000-01-01-15:36:30.123); - END_FUNCTION"; + FUNCTION main : LTOD + main := DT_TO_LTOD(DT#2000-01-01-15:36:30.123); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -169,9 +169,9 @@ fn dt_to_ltod_conversion() { #[test] fn dt_to_tod_conversion() { let src = " - FUNCTION main : TOD - main := DT_TO_TOD(DT#2120-02-12-20:15:11.543); - END_FUNCTION"; + FUNCTION main : TOD + main := DT_TO_TOD(DT#2120-02-12-20:15:11.543); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -188,9 +188,9 @@ fn dt_to_tod_conversion() { #[test] fn ltod_to_tod_conversion() { let src = " - FUNCTION main : TOD - main := LTOD_TO_TOD(LTOD#10:20:30); - END_FUNCTION"; + FUNCTION main : TOD + main := LTOD_TO_TOD(LTOD#10:20:30); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -207,9 +207,9 @@ fn ltod_to_tod_conversion() { #[test] fn tod_to_ltod_conversion() { let src = " - FUNCTION main : LTOD - main := TOD_TO_LTOD(TOD#10:20:30); - END_FUNCTION"; + FUNCTION main : LTOD + main := TOD_TO_LTOD(TOD#10:20:30); + END_FUNCTION"; let sources = add_std!(src, "date_time_conversion.st"); let mut maintype = MainType::default(); let res: i64 = compile_and_run(sources, &mut maintype); diff --git a/libs/stdlib/tests/date_time_extra_functions_tests.rs b/libs/stdlib/tests/date_time_extra_functions_tests.rs index 452da98374..e21528c40e 100644 --- a/libs/stdlib/tests/date_time_extra_functions_tests.rs +++ b/libs/stdlib/tests/date_time_extra_functions_tests.rs @@ -24,9 +24,9 @@ fn get_time_from_hms_milli(hour: u32, min: u32, sec: u32, milli: u32) -> chrono: #[test] fn concat_date_tod() { let src = " - FUNCTION main : DT - main := CONCAT_DATE_TOD(D#2010-03-12, TOD#12:30:15.121121121); - END_FUNCTION"; + FUNCTION main : DT + main := CONCAT_DATE_TOD(D#2010-03-12, TOD#12:30:15.121121121); + END_FUNCTION"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = SingleType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -41,9 +41,9 @@ fn concat_date_tod() { #[test] fn concat_date_ltod() { let src = " - FUNCTION main : LDT - main := CONCAT_DATE_LTOD(D#2010-03-12, LTOD#12:30:15.121121121); - END_FUNCTION"; + FUNCTION main : LDT + main := CONCAT_DATE_LTOD(D#2010-03-12, LTOD#12:30:15.121121121); + END_FUNCTION"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = SingleType::default(); let res: i64 = compile_and_run(sources, &mut maintype); @@ -69,16 +69,16 @@ struct MainType { #[test] fn concat_date_signed_ints() { let src = " - PROGRAM main - VAR - a : DATE; - b : DATE; - c : DATE; - END_VAR - a := CONCAT_DATE(INT#2000,SINT#01,SINT#01); - b := CONCAT_DATE(DINT#2000,DINT#01,DINT#01); - c := CONCAT_DATE(LINT#2000,LINT#01,LINT#01); - END_PROGRAM"; + PROGRAM main + VAR + a : DATE; + b : DATE; + c : DATE; + END_VAR + a := CONCAT_DATE(INT#2000,SINT#01,SINT#01); + b := CONCAT_DATE(DINT#2000,DINT#01,DINT#01); + c := CONCAT_DATE(LINT#2000,LINT#01,LINT#01); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -92,16 +92,16 @@ fn concat_date_signed_ints() { #[test] fn concat_date_unsigned_ints() { let src = " - PROGRAM main - VAR - a : DATE; - b : DATE; - c : DATE; - END_VAR - a := CONCAT_DATE(UINT#2000,USINT#01,USINT#01); - b := CONCAT_DATE(UDINT#2000,UDINT#01,UDINT#01); - c := CONCAT_DATE(ULINT#2000,ULINT#01,ULINT#01); - END_PROGRAM"; + PROGRAM main + VAR + a : DATE; + b : DATE; + c : DATE; + END_VAR + a := CONCAT_DATE(UINT#2000,USINT#01,USINT#01); + b := CONCAT_DATE(UDINT#2000,UDINT#01,UDINT#01); + c := CONCAT_DATE(ULINT#2000,ULINT#01,ULINT#01); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -115,18 +115,18 @@ fn concat_date_unsigned_ints() { #[test] fn concat_tod_signed_ints() { let src = " - PROGRAM main - VAR - a : TOD; - b : TOD; - c : TOD; - d : TOD; - END_VAR - a := CONCAT_TOD(SINT#20,SINT#15,SINT#12,SINT#34); - b := CONCAT_TOD(INT#20,INT#15,INT#12,INT#341); - c := CONCAT_TOD(DINT#20,DINT#15,DINT#12,DINT#341); - d := CONCAT_TOD(LINT#20,LINT#15,LINT#12,LINT#341); - END_PROGRAM"; + PROGRAM main + VAR + a : TOD; + b : TOD; + c : TOD; + d : TOD; + END_VAR + a := CONCAT_TOD(SINT#20,SINT#15,SINT#12,SINT#34); + b := CONCAT_TOD(INT#20,INT#15,INT#12,INT#341); + c := CONCAT_TOD(DINT#20,DINT#15,DINT#12,DINT#341); + d := CONCAT_TOD(LINT#20,LINT#15,LINT#12,LINT#341); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -140,18 +140,18 @@ fn concat_tod_signed_ints() { #[test] fn concat_tod_unsigned_ints() { let src = " - PROGRAM main - VAR - a : TOD; - b : TOD; - c : TOD; - d : TOD; - END_VAR - a := CONCAT_TOD(USINT#20,USINT#15,USINT#12,USINT#34); - b := CONCAT_TOD(UINT#20,UINT#15,UINT#12,UINT#341); - c := CONCAT_TOD(UDINT#20,UDINT#15,UDINT#12,UDINT#341); - d := CONCAT_TOD(ULINT#20,ULINT#15,ULINT#12,ULINT#341); - END_PROGRAM"; + PROGRAM main + VAR + a : TOD; + b : TOD; + c : TOD; + d : TOD; + END_VAR + a := CONCAT_TOD(USINT#20,USINT#15,USINT#12,USINT#34); + b := CONCAT_TOD(UINT#20,UINT#15,UINT#12,UINT#341); + c := CONCAT_TOD(UDINT#20,UDINT#15,UDINT#12,UDINT#341); + d := CONCAT_TOD(ULINT#20,ULINT#15,ULINT#12,ULINT#341); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -165,18 +165,18 @@ fn concat_tod_unsigned_ints() { #[test] fn concat_ltod_signed_ints() { let src = " - PROGRAM main - VAR - a : TOD; - b : TOD; - c : TOD; - d : TOD; - END_VAR - a := CONCAT_LTOD(SINT#20,SINT#15,SINT#12,SINT#34); - b := CONCAT_LTOD(INT#20,INT#15,INT#12,INT#341); - c := CONCAT_LTOD(DINT#20,DINT#15,DINT#12,DINT#341); - d := CONCAT_LTOD(LINT#20,LINT#15,LINT#12,LINT#341); - END_PROGRAM"; + PROGRAM main + VAR + a : TOD; + b : TOD; + c : TOD; + d : TOD; + END_VAR + a := CONCAT_LTOD(SINT#20,SINT#15,SINT#12,SINT#34); + b := CONCAT_LTOD(INT#20,INT#15,INT#12,INT#341); + c := CONCAT_LTOD(DINT#20,DINT#15,DINT#12,DINT#341); + d := CONCAT_LTOD(LINT#20,LINT#15,LINT#12,LINT#341); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -190,18 +190,18 @@ fn concat_ltod_signed_ints() { #[test] fn concat_ltod_unsigned_ints() { let src = " - PROGRAM main - VAR - a : TOD; - b : TOD; - c : TOD; - d : TOD; - END_VAR - a := CONCAT_LTOD(USINT#20,USINT#15,USINT#12,USINT#34); - b := CONCAT_LTOD(UINT#20,UINT#15,UINT#12,UINT#341); - c := CONCAT_LTOD(UDINT#20,UDINT#15,UDINT#12,UDINT#341); - d := CONCAT_LTOD(ULINT#20,ULINT#15,ULINT#12,ULINT#341); - END_PROGRAM"; + PROGRAM main + VAR + a : TOD; + b : TOD; + c : TOD; + d : TOD; + END_VAR + a := CONCAT_LTOD(USINT#20,USINT#15,USINT#12,USINT#34); + b := CONCAT_LTOD(UINT#20,UINT#15,UINT#12,UINT#341); + c := CONCAT_LTOD(UDINT#20,UDINT#15,UDINT#12,UDINT#341); + d := CONCAT_LTOD(ULINT#20,ULINT#15,ULINT#12,ULINT#341); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -215,16 +215,16 @@ fn concat_ltod_unsigned_ints() { #[test] fn concat_dt_signed_ints() { let src = " - PROGRAM main - VAR - a : DT; - b : DT; - c : DT; - END_VAR - a := CONCAT_DT(INT#2000,SINT#1,SINT#2,SINT#20,SINT#15,SINT#12,SINT#111); - b := CONCAT_DT(DINT#2000,DINT#1,DINT#2,DINT#20,DINT#15,DINT#12,DINT#111); - c := CONCAT_DT(LINT#2000,LINT#1,LINT#2,LINT#20,LINT#15,LINT#12,LINT#111); - END_PROGRAM"; + PROGRAM main + VAR + a : DT; + b : DT; + c : DT; + END_VAR + a := CONCAT_DT(INT#2000,SINT#1,SINT#2,SINT#20,SINT#15,SINT#12,SINT#111); + b := CONCAT_DT(DINT#2000,DINT#1,DINT#2,DINT#20,DINT#15,DINT#12,DINT#111); + c := CONCAT_DT(LINT#2000,LINT#1,LINT#2,LINT#20,LINT#15,LINT#12,LINT#111); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -241,16 +241,16 @@ fn concat_dt_signed_ints() { #[test] fn concat_dt_unsigned_ints() { let src = " - PROGRAM main - VAR - a : DT; - b : DT; - c : DT; - END_VAR - a := CONCAT_DT(UINT#2000,USINT#1,USINT#2,USINT#20,USINT#15,USINT#12,USINT#111); - b := CONCAT_DT(UDINT#2000,UDINT#1,UDINT#2,UDINT#20,UDINT#15,UDINT#12,UDINT#111); - c := CONCAT_DT(ULINT#2000,ULINT#1,ULINT#2,ULINT#20,ULINT#15,ULINT#12,ULINT#111); - END_PROGRAM"; + PROGRAM main + VAR + a : DT; + b : DT; + c : DT; + END_VAR + a := CONCAT_DT(UINT#2000,USINT#1,USINT#2,USINT#20,USINT#15,USINT#12,USINT#111); + b := CONCAT_DT(UDINT#2000,UDINT#1,UDINT#2,UDINT#20,UDINT#15,UDINT#12,UDINT#111); + c := CONCAT_DT(ULINT#2000,ULINT#1,ULINT#2,ULINT#20,ULINT#15,ULINT#12,ULINT#111); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -267,16 +267,16 @@ fn concat_dt_unsigned_ints() { #[test] fn concat_ldt_signed_ints() { let src = " - PROGRAM main - VAR - a : LDT; - b : LDT; - c : LDT; - END_VAR - a := CONCAT_LDT(INT#2000,SINT#1,SINT#2,SINT#20,SINT#15,SINT#12,SINT#111); - b := CONCAT_LDT(DINT#2000,DINT#1,DINT#2,DINT#20,DINT#15,DINT#12,DINT#111); - c := CONCAT_LDT(LINT#2000,LINT#1,LINT#2,LINT#20,LINT#15,LINT#12,LINT#111); - END_PROGRAM"; + PROGRAM main + VAR + a : LDT; + b : LDT; + c : LDT; + END_VAR + a := CONCAT_LDT(INT#2000,SINT#1,SINT#2,SINT#20,SINT#15,SINT#12,SINT#111); + b := CONCAT_LDT(DINT#2000,DINT#1,DINT#2,DINT#20,DINT#15,DINT#12,DINT#111); + c := CONCAT_LDT(LINT#2000,LINT#1,LINT#2,LINT#20,LINT#15,LINT#12,LINT#111); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -293,16 +293,16 @@ fn concat_ldt_signed_ints() { #[test] fn concat_ldt_unsigned_ints() { let src = " - PROGRAM main - VAR - a : LDT; - b : LDT; - c : LDT; - END_VAR - a := CONCAT_LDT(UINT#2000,USINT#1,USINT#2,USINT#20,USINT#15,USINT#12,USINT#111); - b := CONCAT_LDT(UDINT#2000,UDINT#1,UDINT#2,UDINT#20,UDINT#15,UDINT#12,UDINT#111); - c := CONCAT_LDT(ULINT#2000,ULINT#1,ULINT#2,ULINT#20,ULINT#15,ULINT#12,ULINT#111); - END_PROGRAM"; + PROGRAM main + VAR + a : LDT; + b : LDT; + c : LDT; + END_VAR + a := CONCAT_LDT(UINT#2000,USINT#1,USINT#2,USINT#20,USINT#15,USINT#12,USINT#111); + b := CONCAT_LDT(UDINT#2000,UDINT#1,UDINT#2,UDINT#20,UDINT#15,UDINT#12,UDINT#111); + c := CONCAT_LDT(ULINT#2000,ULINT#1,ULINT#2,ULINT#20,ULINT#15,ULINT#12,ULINT#111); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -319,14 +319,14 @@ fn concat_ldt_unsigned_ints() { #[test] fn split_date_int() { let src = " - PROGRAM main - VAR - a : INT; // year - b : INT; // month - c : INT; // day - END_VAR - SPLIT_DATE(DATE#2000-01-02, a, b, c); - END_PROGRAM"; + PROGRAM main + VAR + a : INT; // year + b : INT; // month + c : INT; // day + END_VAR + SPLIT_DATE(DATE#2000-01-02, a, b, c); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -338,14 +338,14 @@ fn split_date_int() { #[test] fn split_date_uint() { let src = " - PROGRAM main - VAR - a : UINT; // year - b : UINT; // month - c : UINT; // day - END_VAR - SPLIT_DATE(DATE#2000-01-02, a, b, c); - END_PROGRAM"; + PROGRAM main + VAR + a : UINT; // year + b : UINT; // month + c : UINT; // day + END_VAR + SPLIT_DATE(DATE#2000-01-02, a, b, c); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -357,14 +357,14 @@ fn split_date_uint() { #[test] fn split_date_dint() { let src = " - PROGRAM main - VAR - a : DINT; // year - b : DINT; // month - c : DINT; // day - END_VAR - SPLIT_DATE(DATE#2000-01-02, a, b, c); - END_PROGRAM"; + PROGRAM main + VAR + a : DINT; // year + b : DINT; // month + c : DINT; // day + END_VAR + SPLIT_DATE(DATE#2000-01-02, a, b, c); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -376,14 +376,14 @@ fn split_date_dint() { #[test] fn split_date_udint() { let src = " - PROGRAM main - VAR - a : UDINT; // year - b : UDINT; // month - c : UDINT; // day - END_VAR - SPLIT_DATE(DATE#2000-01-02, a, b, c); - END_PROGRAM"; + PROGRAM main + VAR + a : UDINT; // year + b : UDINT; // month + c : UDINT; // day + END_VAR + SPLIT_DATE(DATE#2000-01-02, a, b, c); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -395,14 +395,14 @@ fn split_date_udint() { #[test] fn split_date_lint() { let src = " - PROGRAM main - VAR - a : LINT; // year - b : LINT; // month - c : LINT; // day - END_VAR - SPLIT_DATE(DATE#2000-01-02, a, b, c); - END_PROGRAM"; + PROGRAM main + VAR + a : LINT; // year + b : LINT; // month + c : LINT; // day + END_VAR + SPLIT_DATE(DATE#2000-01-02, a, b, c); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -414,14 +414,14 @@ fn split_date_lint() { #[test] fn split_date_ulint() { let src = " - PROGRAM main - VAR - a : ULINT; // year - b : ULINT; // month - c : ULINT; // day - END_VAR - SPLIT_DATE(DATE#2000-01-02, a, b, c); - END_PROGRAM"; + PROGRAM main + VAR + a : ULINT; // year + b : ULINT; // month + c : ULINT; // day + END_VAR + SPLIT_DATE(DATE#2000-01-02, a, b, c); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -433,15 +433,15 @@ fn split_date_ulint() { #[test] fn split_tod_int() { let src = " - PROGRAM main - VAR - a : INT; // hour - b : INT; // minute - c : INT; // second - d : INT; // millisecond - END_VAR - SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : INT; // hour + b : INT; // minute + c : INT; // second + d : INT; // millisecond + END_VAR + SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -454,15 +454,15 @@ fn split_tod_int() { #[test] fn split_tod_uint() { let src = " - PROGRAM main - VAR - a : UINT; // hour - b : UINT; // minute - c : UINT; // second - d : UINT; // millisecond - END_VAR - SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : UINT; // hour + b : UINT; // minute + c : UINT; // second + d : UINT; // millisecond + END_VAR + SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -475,15 +475,15 @@ fn split_tod_uint() { #[test] fn split_tod_dint() { let src = " - PROGRAM main - VAR - a : DINT; // hour - b : DINT; // minute - c : DINT; // second - d : DINT; // millisecond - END_VAR - SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : DINT; // hour + b : DINT; // minute + c : DINT; // second + d : DINT; // millisecond + END_VAR + SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -496,15 +496,15 @@ fn split_tod_dint() { #[test] fn split_tod_udint() { let src = " - PROGRAM main - VAR - a : UDINT; // hour - b : UDINT; // minute - c : UDINT; // second - d : UDINT; // millisecond - END_VAR - SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : UDINT; // hour + b : UDINT; // minute + c : UDINT; // second + d : UDINT; // millisecond + END_VAR + SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -517,15 +517,15 @@ fn split_tod_udint() { #[test] fn split_tod_lint() { let src = " - PROGRAM main - VAR - a : LINT; // hour - b : LINT; // minute - c : LINT; // second - d : LINT; // millisecond - END_VAR - SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : LINT; // hour + b : LINT; // minute + c : LINT; // second + d : LINT; // millisecond + END_VAR + SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -538,15 +538,15 @@ fn split_tod_lint() { #[test] fn split_tod_ulint() { let src = " - PROGRAM main - VAR - a : ULINT; // hour - b : ULINT; // minute - c : ULINT; // second - d : ULINT; // millisecond - END_VAR - SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : ULINT; // hour + b : ULINT; // minute + c : ULINT; // second + d : ULINT; // millisecond + END_VAR + SPLIT_TOD(TOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -559,15 +559,15 @@ fn split_tod_ulint() { #[test] fn split_ltod_int() { let src = " - PROGRAM main - VAR - a : INT; // hour - b : INT; // minute - c : INT; // second - d : INT; // millisecond - END_VAR - SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : INT; // hour + b : INT; // minute + c : INT; // second + d : INT; // millisecond + END_VAR + SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -580,15 +580,15 @@ fn split_ltod_int() { #[test] fn split_ltod_uint() { let src = " - PROGRAM main - VAR - a : UINT; // hour - b : UINT; // minute - c : UINT; // second - d : UINT; // millisecond - END_VAR - SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : UINT; // hour + b : UINT; // minute + c : UINT; // second + d : UINT; // millisecond + END_VAR + SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -601,15 +601,15 @@ fn split_ltod_uint() { #[test] fn split_ltod_dint() { let src = " - PROGRAM main - VAR - a : DINT; // hour - b : DINT; // minute - c : DINT; // second - d : DINT; // millisecond - END_VAR - SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : DINT; // hour + b : DINT; // minute + c : DINT; // second + d : DINT; // millisecond + END_VAR + SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -622,15 +622,15 @@ fn split_ltod_dint() { #[test] fn split_ltod_udint() { let src = " - PROGRAM main - VAR - a : UDINT; // hour - b : UDINT; // minute - c : UDINT; // second - d : UDINT; // millisecond - END_VAR - SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : UDINT; // hour + b : UDINT; // minute + c : UDINT; // second + d : UDINT; // millisecond + END_VAR + SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -643,15 +643,15 @@ fn split_ltod_udint() { #[test] fn split_ltod_lint() { let src = " - PROGRAM main - VAR - a : LINT; // hour - b : LINT; // minute - c : LINT; // second - d : LINT; // millisecond - END_VAR - SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : LINT; // hour + b : LINT; // minute + c : LINT; // second + d : LINT; // millisecond + END_VAR + SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -664,15 +664,15 @@ fn split_ltod_lint() { #[test] fn split_ltod_ulint() { let src = " - PROGRAM main - VAR - a : ULINT; // hour - b : ULINT; // minute - c : ULINT; // second - d : ULINT; // millisecond - END_VAR - SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); - END_PROGRAM"; + PROGRAM main + VAR + a : ULINT; // hour + b : ULINT; // minute + c : ULINT; // second + d : ULINT; // millisecond + END_VAR + SPLIT_TOD(LTOD#14:12:03.123, a, b, c, d); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -685,18 +685,18 @@ fn split_ltod_ulint() { #[test] fn split_dt_int() { let src = " - PROGRAM main - VAR - a : INT; // year - b : INT; // month - c : INT; // day - d : INT; // hour - e : INT; // minute - f : INT; // second - g : INT; // millisecond - END_VAR - SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : INT; // year + b : INT; // month + c : INT; // day + d : INT; // hour + e : INT; // minute + f : INT; // second + g : INT; // millisecond + END_VAR + SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -712,18 +712,18 @@ fn split_dt_int() { #[test] fn split_dt_uint() { let src = " - PROGRAM main - VAR - a : UINT; // year - b : UINT; // month - c : UINT; // day - d : UINT; // hour - e : UINT; // minute - f : UINT; // second - g : UINT; // millisecond - END_VAR - SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : UINT; // year + b : UINT; // month + c : UINT; // day + d : UINT; // hour + e : UINT; // minute + f : UINT; // second + g : UINT; // millisecond + END_VAR + SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -739,18 +739,18 @@ fn split_dt_uint() { #[test] fn split_dt_dint() { let src = " - PROGRAM main - VAR - a : DINT; // year - b : DINT; // month - c : DINT; // day - d : DINT; // hour - e : DINT; // minute - f : DINT; // second - g : DINT; // millisecond - END_VAR - SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : DINT; // year + b : DINT; // month + c : DINT; // day + d : DINT; // hour + e : DINT; // minute + f : DINT; // second + g : DINT; // millisecond + END_VAR + SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -766,18 +766,18 @@ fn split_dt_dint() { #[test] fn split_dt_udint() { let src = " - PROGRAM main - VAR - a : UDINT; // year - b : UDINT; // month - c : UDINT; // day - d : UDINT; // hour - e : UDINT; // minute - f : UDINT; // second - g : UDINT; // millisecond - END_VAR - SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : UDINT; // year + b : UDINT; // month + c : UDINT; // day + d : UDINT; // hour + e : UDINT; // minute + f : UDINT; // second + g : UDINT; // millisecond + END_VAR + SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -793,18 +793,18 @@ fn split_dt_udint() { #[test] fn split_dt_lint() { let src = " - PROGRAM main - VAR - a : LINT; // year - b : LINT; // month - c : LINT; // day - d : LINT; // hour - e : LINT; // minute - f : LINT; // second - g : LINT; // millisecond - END_VAR - SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : LINT; // year + b : LINT; // month + c : LINT; // day + d : LINT; // hour + e : LINT; // minute + f : LINT; // second + g : LINT; // millisecond + END_VAR + SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -820,18 +820,18 @@ fn split_dt_lint() { #[test] fn split_dt_ulint() { let src = " - PROGRAM main - VAR - a : ULINT; // year - b : ULINT; // month - c : ULINT; // day - d : ULINT; // hour - e : ULINT; // minute - f : ULINT; // second - g : ULINT; // millisecond - END_VAR - SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : ULINT; // year + b : ULINT; // month + c : ULINT; // day + d : ULINT; // hour + e : ULINT; // minute + f : ULINT; // second + g : ULINT; // millisecond + END_VAR + SPLIT_DT(DT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -847,18 +847,18 @@ fn split_dt_ulint() { #[test] fn split_ldt_int() { let src = " - PROGRAM main - VAR - a : INT; // year - b : INT; // month - c : INT; // day - d : INT; // hour - e : INT; // minute - f : INT; // second - g : INT; // millisecond - END_VAR - SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : INT; // year + b : INT; // month + c : INT; // day + d : INT; // hour + e : INT; // minute + f : INT; // second + g : INT; // millisecond + END_VAR + SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -874,18 +874,18 @@ fn split_ldt_int() { #[test] fn split_ldt_uint() { let src = " - PROGRAM main - VAR - a : UINT; // year - b : UINT; // month - c : UINT; // day - d : UINT; // hour - e : UINT; // minute - f : UINT; // second - g : UINT; // millisecond - END_VAR - SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : UINT; // year + b : UINT; // month + c : UINT; // day + d : UINT; // hour + e : UINT; // minute + f : UINT; // second + g : UINT; // millisecond + END_VAR + SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -901,18 +901,18 @@ fn split_ldt_uint() { #[test] fn split_ldt_dint() { let src = " - PROGRAM main - VAR - a : DINT; // year - b : DINT; // month - c : DINT; // day - d : DINT; // hour - e : DINT; // minute - f : DINT; // second - g : DINT; // millisecond - END_VAR - SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : DINT; // year + b : DINT; // month + c : DINT; // day + d : DINT; // hour + e : DINT; // minute + f : DINT; // second + g : DINT; // millisecond + END_VAR + SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -928,18 +928,18 @@ fn split_ldt_dint() { #[test] fn split_ldt_udint() { let src = " - PROGRAM main - VAR - a : UDINT; // year - b : UDINT; // month - c : UDINT; // day - d : UDINT; // hour - e : UDINT; // minute - f : UDINT; // second - g : UDINT; // millisecond - END_VAR - SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : UDINT; // year + b : UDINT; // month + c : UDINT; // day + d : UDINT; // hour + e : UDINT; // minute + f : UDINT; // second + g : UDINT; // millisecond + END_VAR + SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -955,18 +955,18 @@ fn split_ldt_udint() { #[test] fn split_ldt_lint() { let src = " - PROGRAM main - VAR - a : LINT; // year - b : LINT; // month - c : LINT; // day - d : LINT; // hour - e : LINT; // minute - f : LINT; // second - g : LINT; // millisecond - END_VAR - SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : LINT; // year + b : LINT; // month + c : LINT; // day + d : LINT; // hour + e : LINT; // minute + f : LINT; // second + g : LINT; // millisecond + END_VAR + SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -982,18 +982,18 @@ fn split_ldt_lint() { #[test] fn split_ldt_ulint() { let src = " - PROGRAM main - VAR - a : ULINT; // year - b : ULINT; // month - c : ULINT; // day - d : ULINT; // hour - e : ULINT; // minute - f : ULINT; // second - g : ULINT; // millisecond - END_VAR - SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); - END_PROGRAM"; + PROGRAM main + VAR + a : ULINT; // year + b : ULINT; // month + c : ULINT; // day + d : ULINT; // hour + e : ULINT; // minute + f : ULINT; // second + g : ULINT; // millisecond + END_VAR + SPLIT_DT(LDT#2000-01-02-14:12:03.123, a, b, c, d, e, f, g); + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -1009,16 +1009,16 @@ fn split_ldt_ulint() { #[test] fn day_of_week() { let src = " - PROGRAM main - VAR - a : SINT; - b : SINT; - c : SINT; - END_VAR - a := DAY_OF_WEEK(DATE#2022-06-14); // tuesday = 2 - b := DAY_OF_WEEK(DATE#2022-06-12); // sunday = 0 - c := DAY_OF_WEEK(DATE#2022-06-18); // saturday = 6 - END_PROGRAM"; + PROGRAM main + VAR + a : SINT; + b : SINT; + c : SINT; + END_VAR + a := DAY_OF_WEEK(DATE#2022-06-14); // tuesday = 2 + b := DAY_OF_WEEK(DATE#2022-06-12); // sunday = 0 + c := DAY_OF_WEEK(DATE#2022-06-18); // saturday = 6 + END_PROGRAM"; let sources = add_std!(src, "date_time_extra_functions.st"); let mut maintype = MainType::::default(); let _: i64 = compile_and_run(sources, &mut maintype); diff --git a/libs/stdlib/tests/date_time_numeric_functions_tests.rs b/libs/stdlib/tests/date_time_numeric_functions_tests.rs index 60841de260..2c40fdff06 100644 --- a/libs/stdlib/tests/date_time_numeric_functions_tests.rs +++ b/libs/stdlib/tests/date_time_numeric_functions_tests.rs @@ -28,19 +28,19 @@ fn get_time_from_hms_milli(hour: u32, min: u32, sec: u32, milli: u32) -> chrono: #[test] fn add_time() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := ADD(TIME#5h,TIME#30s); - b := ADD_TIME(TIME#10s,TIME#-5s); + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := ADD(TIME#5h,TIME#30s); + b := ADD_TIME(TIME#10s,TIME#-5s); - c := ADD(LTIME#-10s,LTIME#-10s); - d := ADD_LTIME(LTIME#10s,LTIME#10s); - END_PROGRAM"; + c := ADD(LTIME#-10s,LTIME#-10s); + d := ADD_LTIME(LTIME#10s,LTIME#10s); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -54,18 +54,18 @@ fn add_time() { #[test] fn add_tod_time() { let src = " - PROGRAM main - VAR - a : TOD; - b : TOD; - c : LTOD; - d : LTOD; - END_VAR - a := ADD_TOD_TIME(TOD#20:00:00, TIME#1s); - b := ADD(TOD#20:00:02, TIME#-1s); - c := ADD_LTOD_LTIME(LTOD#12:00:00, LTIME#12m12s); - d := ADD(LTOD#12:00:00, LTIME#12m12s); - END_PROGRAM"; + PROGRAM main + VAR + a : TOD; + b : TOD; + c : LTOD; + d : LTOD; + END_VAR + a := ADD_TOD_TIME(TOD#20:00:00, TIME#1s); + b := ADD(TOD#20:00:02, TIME#-1s); + c := ADD_LTOD_LTIME(LTOD#12:00:00, LTIME#12m12s); + d := ADD(LTOD#12:00:00, LTIME#12m12s); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -80,18 +80,18 @@ fn add_tod_time() { #[test] fn add_dt_time() { let src = " - PROGRAM main - VAR - a : DT; - b : DT; - c : LDT; - d : LDT; - END_VAR - a := ADD_DT_TIME(DT#2000-01-01-12:00:00, TIME#1d12m12s123ms); - b := ADD(DT#2000-01-01-12:00:00, TIME#1d12m12s123ms); - c := ADD_LDT_LTIME(LDT#2000-01-01-12:00:00, LTIME#1d12m12s123ms); - d := ADD(LDT#2000-01-01-12:00:00, LTIME#1d12m12s123ms); - END_PROGRAM"; + PROGRAM main + VAR + a : DT; + b : DT; + c : LDT; + d : LDT; + END_VAR + a := ADD_DT_TIME(DT#2000-01-01-12:00:00, TIME#1d12m12s123ms); + b := ADD(DT#2000-01-01-12:00:00, TIME#1d12m12s123ms); + c := ADD_LDT_LTIME(LDT#2000-01-01-12:00:00, LTIME#1d12m12s123ms); + d := ADD(LDT#2000-01-01-12:00:00, LTIME#1d12m12s123ms); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -111,12 +111,12 @@ fn add_dt_time() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn add_overflow() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := ADD(TIME#9223372036854775807ms, TIME#1ms); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := ADD(TIME#9223372036854775807ms, TIME#1ms); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -125,19 +125,19 @@ fn add_overflow() { #[test] fn sub_time() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := SUB(TIME#10h50m, TIME#-10m); - b := SUB_TIME(TIME#5h35m20s, TIME#1h5m20s); + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := SUB(TIME#10h50m, TIME#-10m); + b := SUB_TIME(TIME#5h35m20s, TIME#1h5m20s); - c := SUB(LTIME#10h50m, LTIME#6h20m); - d := SUB_LTIME(LTIME#5h35m20s, LTIME#1h5m20s); - END_PROGRAM"; + c := SUB(LTIME#10h50m, LTIME#6h20m); + d := SUB_LTIME(LTIME#5h35m20s, LTIME#1h5m20s); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -151,19 +151,19 @@ fn sub_time() { #[test] fn sub_date() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := SUB(DATE#2000-12-31, DATE#2000-01-01); - b := SUB_DATE_DATE(DATE#2000-05-21, DATE#2000-05-01); - - c := SUB(LDATE#2000-12-31, LDATE#2000-01-01); - d := SUB_LDATE_LDATE(LDATE#2000-05-21, LDATE#2000-05-01); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := SUB(DATE#2000-12-31, DATE#2000-01-01); + b := SUB_DATE_DATE(DATE#2000-05-21, DATE#2000-05-01); + + c := SUB(LDATE#2000-12-31, LDATE#2000-01-01); + d := SUB_LDATE_LDATE(LDATE#2000-05-21, LDATE#2000-05-01); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -178,18 +178,18 @@ fn sub_date() { #[test] fn sub_tod_time() { let src = " - PROGRAM main - VAR - a : TOD; - b : TOD; - c : LTOD; - d : LTOD; - END_VAR - a := SUB_TOD_TIME(TOD#23:10:05.123, TIME#3h10m5s123ms); - b := SUB(TOD#23:10:05.123, TIME#3h10m5s123ms); - c := SUB_LTOD_LTIME(LTOD#23:10:05.123, LTIME#3h10m5s123ms); - d := SUB(LTOD#23:10:05.123, LTIME#3h10m5s123ms); - END_PROGRAM"; + PROGRAM main + VAR + a : TOD; + b : TOD; + c : LTOD; + d : LTOD; + END_VAR + a := SUB_TOD_TIME(TOD#23:10:05.123, TIME#3h10m5s123ms); + b := SUB(TOD#23:10:05.123, TIME#3h10m5s123ms); + c := SUB_LTOD_LTIME(LTOD#23:10:05.123, LTIME#3h10m5s123ms); + d := SUB(LTOD#23:10:05.123, LTIME#3h10m5s123ms); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -203,18 +203,18 @@ fn sub_tod_time() { #[test] fn sub_tod() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := SUB(TOD#23:10:05.123, TOD#3:10:05.123); - b := SUB_TOD_TOD(TOD#23:10:05.123, TOD#3:10:05.123); - c := SUB(LTOD#23:10:05.123, LTOD#3:10:05.123); - d := SUB_LTOD_LTOD(LTOD#23:10:05.123, LTOD#3:10:05.123); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := SUB(TOD#23:10:05.123, TOD#3:10:05.123); + b := SUB_TOD_TOD(TOD#23:10:05.123, TOD#3:10:05.123); + c := SUB(LTOD#23:10:05.123, LTOD#3:10:05.123); + d := SUB_LTOD_LTOD(LTOD#23:10:05.123, LTOD#3:10:05.123); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -228,18 +228,18 @@ fn sub_tod() { #[test] fn sub_dt_time() { let src = " - PROGRAM main - VAR - a : DT; - b : DT; - c : LDT; - d : LDT; - END_VAR - a := SUB(DT#2000-01-02-21:15:12.345, TIME#1d1h15m12s345ms); - b := SUB_DT_TIME(DT#2000-01-02-21:15:12.345, TIME#1d1h15m12s345ms); - c := SUB(LDT#2000-01-02-21:15:12.345, LTIME#1d1h15m12s345ms); - d := SUB_LDT_LTIME(LDT#2000-01-02-21:15:12.345, LTIME#1d1h15m12s345ms); - END_PROGRAM"; + PROGRAM main + VAR + a : DT; + b : DT; + c : LDT; + d : LDT; + END_VAR + a := SUB(DT#2000-01-02-21:15:12.345, TIME#1d1h15m12s345ms); + b := SUB_DT_TIME(DT#2000-01-02-21:15:12.345, TIME#1d1h15m12s345ms); + c := SUB(LDT#2000-01-02-21:15:12.345, LTIME#1d1h15m12s345ms); + d := SUB_LDT_LTIME(LDT#2000-01-02-21:15:12.345, LTIME#1d1h15m12s345ms); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -254,18 +254,18 @@ fn sub_dt_time() { #[test] fn sub_dt() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := SUB(DT#2000-01-02-21:22:33.444, DT#2000-01-01-10:00:00.000); - b := SUB_DT_DT(DT#2000-01-02-21:22:33.444, DT#2000-01-01-10:00:00.000); - c := SUB(LDT#2000-01-02-21:22:33.444, LDT#2000-01-01-10:00:00.000); - d := SUB_LDT_LDT(LDT#2000-01-02-21:22:33.444, LDT#2000-01-01-10:00:00.000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := SUB(DT#2000-01-02-21:22:33.444, DT#2000-01-01-10:00:00.000); + b := SUB_DT_DT(DT#2000-01-02-21:22:33.444, DT#2000-01-01-10:00:00.000); + c := SUB(LDT#2000-01-02-21:22:33.444, LDT#2000-01-01-10:00:00.000); + d := SUB_LDT_LDT(LDT#2000-01-02-21:22:33.444, LDT#2000-01-01-10:00:00.000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -284,12 +284,12 @@ fn sub_dt() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn sub_overflow() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := SUB(TIME#-9223372036854775807ms, TIME#1ms); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := SUB(TIME#-9223372036854775807ms, TIME#1ms); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -298,18 +298,18 @@ fn sub_overflow() { #[test] fn mul_signed() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := MUL(TIME#1d, SINT#-120); - b := MUL(TIME#1s, INT#3600); - c := MUL(LTIME#1000ms, DINT#86400); - d := MUL(LTIME#1000ms, LINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := MUL(TIME#1d, SINT#-120); + b := MUL(TIME#1s, INT#3600); + c := MUL(LTIME#1000ms, DINT#86400); + d := MUL(LTIME#1000ms, LINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -327,13 +327,13 @@ fn mul_signed() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn mul_signed_overflow() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - // overflow -> 0 will be returned - a := MUL(TIME#10ns, LINT#9223372036854775807); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + // overflow -> 0 will be returned + a := MUL(TIME#10ns, LINT#9223372036854775807); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -342,18 +342,18 @@ fn mul_signed_overflow() { #[test] fn mul_unsigned() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := MUL(TIME#-1d, USINT#120); - b := MUL(TIME#1s, UINT#3600); - c := MUL(LTIME#1000ms, UDINT#86400); - d := MUL(LTIME#1000ms, ULINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := MUL(TIME#-1d, USINT#120); + b := MUL(TIME#1s, UINT#3600); + c := MUL(LTIME#1000ms, UDINT#86400); + d := MUL(LTIME#1000ms, ULINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -371,13 +371,13 @@ fn mul_unsigned() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn mul_unsigned_overflow() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - // overflow -> 0 will be returned - a := MUL(TIME#1ns, ULINT#9223372036854775808); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + // overflow -> 0 will be returned + a := MUL(TIME#1ns, ULINT#9223372036854775808); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -386,18 +386,18 @@ fn mul_unsigned_overflow() { #[test] fn mul_time_signed() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : TIME; - d : TIME; - END_VAR - a := MUL_TIME(TIME#1d, SINT#-120); - b := MUL_TIME(TIME#1s, INT#3600); - c := MUL_TIME(TIME#1000ms, DINT#86400); - d := MUL_TIME(TIME#1000ms, LINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : TIME; + d : TIME; + END_VAR + a := MUL_TIME(TIME#1d, SINT#-120); + b := MUL_TIME(TIME#1s, INT#3600); + c := MUL_TIME(TIME#1000ms, DINT#86400); + d := MUL_TIME(TIME#1000ms, LINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -413,18 +413,18 @@ fn mul_time_signed() { #[test] fn mul_time_unsigned() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : TIME; - d : TIME; - END_VAR - a := MUL_TIME(TIME#-1d, USINT#120); - b := MUL_TIME(TIME#1s, UINT#3600); - c := MUL_TIME(TIME#1000ms, UDINT#86400); - d := MUL_TIME(TIME#1000ms, ULINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : TIME; + d : TIME; + END_VAR + a := MUL_TIME(TIME#-1d, USINT#120); + b := MUL_TIME(TIME#1s, UINT#3600); + c := MUL_TIME(TIME#1000ms, UDINT#86400); + d := MUL_TIME(TIME#1000ms, ULINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -440,18 +440,18 @@ fn mul_time_unsigned() { #[test] fn mul_ltime_signed() { let src = " - PROGRAM main - VAR - a : LTIME; - b : LTIME; - c : LTIME; - d : LTIME; - END_VAR - a := MUL_LTIME(LTIME#1d, SINT#-120); - b := MUL_LTIME(LTIME#1s, INT#3600); - c := MUL_LTIME(LTIME#1000ms, DINT#86400); - d := MUL_LTIME(LTIME#1000ms, LINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : LTIME; + b : LTIME; + c : LTIME; + d : LTIME; + END_VAR + a := MUL_LTIME(LTIME#1d, SINT#-120); + b := MUL_LTIME(LTIME#1s, INT#3600); + c := MUL_LTIME(LTIME#1000ms, DINT#86400); + d := MUL_LTIME(LTIME#1000ms, LINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -467,18 +467,18 @@ fn mul_ltime_signed() { #[test] fn mul_ltime_unsigned() { let src = " - PROGRAM main - VAR - a : LTIME; - b : LTIME; - c : LTIME; - d : LTIME; - END_VAR - a := MUL_LTIME(LTIME#-1d, USINT#120); - b := MUL_LTIME(LTIME#1s, UINT#3600); - c := MUL_LTIME(LTIME#1000ms, UDINT#86400); - d := MUL_LTIME(LTIME#1000ms, ULINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : LTIME; + b : LTIME; + c : LTIME; + d : LTIME; + END_VAR + a := MUL_LTIME(LTIME#-1d, USINT#120); + b := MUL_LTIME(LTIME#1s, UINT#3600); + c := MUL_LTIME(LTIME#1000ms, UDINT#86400); + d := MUL_LTIME(LTIME#1000ms, ULINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -494,18 +494,18 @@ fn mul_ltime_unsigned() { #[test] fn div_signed() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := DIV(TIME#1m, SINT#60); - b := DIV(TIME#1h, INT#-3600); - c := DIV(LTIME#1d, DINT#86400); - d := DIV(LTIME#10000d, DINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := DIV(TIME#1m, SINT#60); + b := DIV(TIME#1h, INT#-3600); + c := DIV(LTIME#1d, DINT#86400); + d := DIV(LTIME#10000d, DINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -519,18 +519,18 @@ fn div_signed() { #[test] fn div_unsigned() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : LTIME; - d : LTIME; - END_VAR - a := DIV(TIME#1m, USINT#60); - b := DIV(TIME#-1h, UINT#3600); - c := DIV(LTIME#1d, UDINT#86400); - d := DIV(LTIME#10000d, UDINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : LTIME; + d : LTIME; + END_VAR + a := DIV(TIME#1m, USINT#60); + b := DIV(TIME#-1h, UINT#3600); + c := DIV(LTIME#1d, UDINT#86400); + d := DIV(LTIME#10000d, UDINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -546,12 +546,12 @@ fn div_unsigned() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn div_by_zero() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := DIV(TIME#1m, USINT#0); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := DIV(TIME#1m, USINT#0); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -560,18 +560,18 @@ fn div_by_zero() { #[test] fn div_time_signed() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : TIME; - d : TIME; - END_VAR - a := DIV_TIME(TIME#1m, SINT#60); - b := DIV_TIME(TIME#1h, INT#-3600); - c := DIV_TIME(TIME#1d, DINT#86400); - d := DIV_TIME(TIME#10000d, DINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : TIME; + d : TIME; + END_VAR + a := DIV_TIME(TIME#1m, SINT#60); + b := DIV_TIME(TIME#1h, INT#-3600); + c := DIV_TIME(TIME#1d, DINT#86400); + d := DIV_TIME(TIME#10000d, DINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -585,18 +585,18 @@ fn div_time_signed() { #[test] fn div_time_unsigned() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - c : TIME; - d : TIME; - END_VAR - a := DIV_TIME(TIME#1m, USINT#60); - b := DIV_TIME(TIME#-1h, UINT#3600); - c := DIV_TIME(TIME#1d, UDINT#86400); - d := DIV_TIME(TIME#10000d, UDINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + c : TIME; + d : TIME; + END_VAR + a := DIV_TIME(TIME#1m, USINT#60); + b := DIV_TIME(TIME#-1h, UINT#3600); + c := DIV_TIME(TIME#1d, UDINT#86400); + d := DIV_TIME(TIME#10000d, UDINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -610,18 +610,18 @@ fn div_time_unsigned() { #[test] fn div_ltime_signed() { let src = " - PROGRAM main - VAR - a : LTIME; - b : LTIME; - c : LTIME; - d : LTIME; - END_VAR - a := DIV_LTIME(LTIME#1m, SINT#60); - b := DIV_LTIME(LTIME#1h, INT#-3600); - c := DIV_LTIME(LTIME#1d, DINT#86400); - d := DIV_LTIME(LTIME#10000d, DINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : LTIME; + b : LTIME; + c : LTIME; + d : LTIME; + END_VAR + a := DIV_LTIME(LTIME#1m, SINT#60); + b := DIV_LTIME(LTIME#1h, INT#-3600); + c := DIV_LTIME(LTIME#1d, DINT#86400); + d := DIV_LTIME(LTIME#10000d, DINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -635,18 +635,18 @@ fn div_ltime_signed() { #[test] fn div_ltime_unsigned() { let src = " - PROGRAM main - VAR - a : LTIME; - b : LTIME; - c : LTIME; - d : LTIME; - END_VAR - a := DIV_LTIME(LTIME#1m, USINT#60); - b := DIV_LTIME(LTIME#-1h, UINT#3600); - c := DIV_LTIME(LTIME#1d, UDINT#86400); - d := DIV_LTIME(LTIME#10000d, UDINT#864000000); - END_PROGRAM"; + PROGRAM main + VAR + a : LTIME; + b : LTIME; + c : LTIME; + d : LTIME; + END_VAR + a := DIV_LTIME(LTIME#1m, USINT#60); + b := DIV_LTIME(LTIME#-1h, UINT#3600); + c := DIV_LTIME(LTIME#1d, UDINT#86400); + d := DIV_LTIME(LTIME#10000d, UDINT#864000000); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -660,16 +660,16 @@ fn div_ltime_unsigned() { #[test] fn mul_real() { let src = " - PROGRAM main - VAR - a : TIME; - b : LTIME; - c : TIME; - END_VAR - a := MUL(TIME#-2s700ms, REAL#3.14); - b := MUL(LTIME#2s700ms, REAL#3.14e5); - c := MUL(TIME#2s700ms, REAL#-3.14); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : LTIME; + c : TIME; + END_VAR + a := MUL(TIME#-2s700ms, REAL#3.14); + b := MUL(LTIME#2s700ms, REAL#3.14e5); + c := MUL(TIME#2s700ms, REAL#-3.14); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -692,12 +692,12 @@ fn mul_real() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn mul_real_overflow() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := MUL(TIME#-2s700ms, REAL#3.40282347e38); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := MUL(TIME#-2s700ms, REAL#3.40282347e38); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -706,16 +706,16 @@ fn mul_real_overflow() { #[test] fn mul_lreal() { let src = " - PROGRAM main - VAR - a : TIME; - b : LTIME; - c : TIME; - END_VAR - a := MUL(TIME#-2s700ms, LREAL#3.14); - b := MUL(LTIME#2s700ms, LREAL#3.14e5); - c := MUL(TIME#-2s700ms, LREAL#-3.14); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : LTIME; + c : TIME; + END_VAR + a := MUL(TIME#-2s700ms, LREAL#3.14); + b := MUL(LTIME#2s700ms, LREAL#3.14e5); + c := MUL(TIME#-2s700ms, LREAL#-3.14); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -744,12 +744,12 @@ fn mul_lreal() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn mul_lreal_overflow() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := MUL(TIME#-2s700ms, LREAL#3.40282347e38); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := MUL(TIME#-2s700ms, LREAL#3.40282347e38); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -758,14 +758,14 @@ fn mul_lreal_overflow() { #[test] fn mul_time() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - END_VAR - a := MUL_TIME(TIME#2s700ms, REAL#3.14); - b := MUL_TIME(TIME#2s700ms, LREAL#3.14e5); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + END_VAR + a := MUL_TIME(TIME#2s700ms, REAL#3.14); + b := MUL_TIME(TIME#2s700ms, LREAL#3.14e5); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -783,14 +783,14 @@ fn mul_time() { #[test] fn mul_ltime() { let src = " - PROGRAM main - VAR - a : LTIME; - b : LTIME; - END_VAR - a := MUL_LTIME(LTIME#2s700ms, REAL#3.14); - b := MUL_LTIME(LTIME#2s700ms, LREAL#3.14e5); - END_PROGRAM"; + PROGRAM main + VAR + a : LTIME; + b : LTIME; + END_VAR + a := MUL_LTIME(LTIME#2s700ms, REAL#3.14); + b := MUL_LTIME(LTIME#2s700ms, LREAL#3.14e5); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -809,14 +809,14 @@ fn mul_ltime() { #[test] fn div_real() { let src = " - PROGRAM main - VAR - a : TIME; - b : LTIME; - END_VAR - a := DIV(TIME#-8s478ms, REAL#3.14); - b := DIV(LTIME#847800s, REAL#3.14e5); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : LTIME; + END_VAR + a := DIV(TIME#-8s478ms, REAL#3.14); + b := DIV(LTIME#847800s, REAL#3.14e5); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -835,12 +835,12 @@ fn div_real() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn div_real_by_zero() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := DIV(TIME#-2s700ms, REAL#0.0); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := DIV(TIME#-2s700ms, REAL#0.0); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -849,14 +849,14 @@ fn div_real_by_zero() { #[test] fn div_lreal() { let src = " - PROGRAM main - VAR - a : TIME; - b : LTIME; - END_VAR - a := DIV(TIME#-8s478ms, LREAL#3.14); - b := DIV(LTIME#847800s, LREAL#3.14e5); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : LTIME; + END_VAR + a := DIV(TIME#-8s478ms, LREAL#3.14); + b := DIV(LTIME#847800s, LREAL#3.14e5); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -875,12 +875,12 @@ fn div_lreal() { #[cfg_attr(target_arch = "aarch64", ignore = "https://github.com/PLC-lang/rusty/pull/960")] fn div_lreal_by_zero() { let src = " - PROGRAM main - VAR - a : TIME; - END_VAR - a := DIV(TIME#-2s700ms, LREAL#0.0); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + END_VAR + a := DIV(TIME#-2s700ms, LREAL#0.0); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -889,14 +889,14 @@ fn div_lreal_by_zero() { #[test] fn div_time() { let src = " - PROGRAM main - VAR - a : TIME; - b : TIME; - END_VAR - a := DIV_TIME(TIME#8s478ms, REAL#3.14); - b := DIV_TIME(TIME#847800s, LREAL#3.14e5); - END_PROGRAM"; + PROGRAM main + VAR + a : TIME; + b : TIME; + END_VAR + a := DIV_TIME(TIME#8s478ms, REAL#3.14); + b := DIV_TIME(TIME#847800s, LREAL#3.14e5); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -913,14 +913,14 @@ fn div_time() { #[test] fn div_ltime() { let src = " - PROGRAM main - VAR - a : LTIME; - b : LTIME; - END_VAR - a := DIV_LTIME(LTIME#8s478ms, REAL#3.14); - b := DIV_LTIME(LTIME#847800s, LREAL#3.14e5); - END_PROGRAM"; + PROGRAM main + VAR + a : LTIME; + b : LTIME; + END_VAR + a := DIV_LTIME(LTIME#8s478ms, REAL#3.14); + b := DIV_LTIME(LTIME#847800s, LREAL#3.14e5); + END_PROGRAM"; let sources = add_std!(src, "date_time_numeric_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); diff --git a/libs/stdlib/tests/endianness_conversion_functions_tests.rs b/libs/stdlib/tests/endianness_conversion_functions_tests.rs index 27521fc701..472c9959e3 100644 --- a/libs/stdlib/tests/endianness_conversion_functions_tests.rs +++ b/libs/stdlib/tests/endianness_conversion_functions_tests.rs @@ -12,7 +12,7 @@ const DURATION_NANOS: i64 = DURATION_MILLIS * 1000000; fn test_to_big_endian_int() { let src = r#"FUNCTION main : INT main := TO_BIG_ENDIAN(INT#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -24,7 +24,7 @@ fn test_to_big_endian_int() { fn test_to_little_endian_int() { let src = r#"FUNCTION main : INT main := TO_LITTLE_ENDIAN(INT#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -36,7 +36,7 @@ fn test_to_little_endian_int() { fn test_from_big_endian_int() { let src = r#"FUNCTION main : INT main := FROM_BIG_ENDIAN(INT#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -48,7 +48,7 @@ fn test_from_big_endian_int() { fn test_from_little_endian_int() { let src = r#"FUNCTION main : INT main := FROM_LITTLE_ENDIAN(INT#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -61,7 +61,7 @@ fn test_from_little_endian_int() { fn test_to_big_endian_dint() { let src = r#"FUNCTION main : DINT main := TO_BIG_ENDIAN(DINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -73,7 +73,7 @@ fn test_to_big_endian_dint() { fn test_to_little_endian_dint() { let src = r#"FUNCTION main : DINT main := TO_LITTLE_ENDIAN(DINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -85,7 +85,7 @@ fn test_to_little_endian_dint() { fn test_from_big_endian_dint() { let src = r#"FUNCTION main : DINT main := FROM_BIG_ENDIAN(DINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -97,7 +97,7 @@ fn test_from_big_endian_dint() { fn test_from_little_endian_dint() { let src = r#"FUNCTION main : DINT main := FROM_LITTLE_ENDIAN(DINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -110,7 +110,7 @@ fn test_from_little_endian_dint() { fn test_to_big_endian_lint() { let src = r#"FUNCTION main : LINT main := TO_BIG_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -122,7 +122,7 @@ fn test_to_big_endian_lint() { fn test_to_little_endian_lint() { let src = r#"FUNCTION main : LINT main := TO_LITTLE_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -134,7 +134,7 @@ fn test_to_little_endian_lint() { fn test_from_big_endian_lint() { let src = r#"FUNCTION main : LINT main := FROM_BIG_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -146,7 +146,7 @@ fn test_from_big_endian_lint() { fn test_from_little_endian_lint() { let src = r#"FUNCTION main : LINT main := FROM_LITTLE_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -159,7 +159,7 @@ fn test_from_little_endian_lint() { fn test_to_big_endian_uint() { let src = r#"FUNCTION main : UINT main := TO_BIG_ENDIAN(UINT#16#ABBA); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -171,7 +171,7 @@ fn test_to_big_endian_uint() { fn test_to_little_endian_uint() { let src = r#"FUNCTION main : UINT main := TO_LITTLE_ENDIAN(UINT#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -183,7 +183,7 @@ fn test_to_little_endian_uint() { fn test_from_big_endian_uint() { let src = r#"FUNCTION main : UINT main := FROM_BIG_ENDIAN(UINT#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -195,7 +195,7 @@ fn test_from_big_endian_uint() { fn test_from_little_endian_uint() { let src = r#"FUNCTION main : UINT main := FROM_LITTLE_ENDIAN(UINT#16#ABBA); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -208,7 +208,7 @@ fn test_from_little_endian_uint() { fn test_to_big_endian_udint() { let src = r#"FUNCTION main : UDINT main := TO_BIG_ENDIAN(UDINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -220,7 +220,7 @@ fn test_to_big_endian_udint() { fn test_to_little_endian_udint() { let src = r#"FUNCTION main : UDINT main := TO_LITTLE_ENDIAN(UDINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -232,7 +232,7 @@ fn test_to_little_endian_udint() { fn test_from_big_endian_udint() { let src = r#"FUNCTION main : UDINT main := FROM_BIG_ENDIAN(UDINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -244,7 +244,7 @@ fn test_from_big_endian_udint() { fn test_from_little_endian_udint() { let src = r#"FUNCTION main : UDINT main := FROM_LITTLE_ENDIAN(UDINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -257,7 +257,7 @@ fn test_from_little_endian_udint() { fn test_to_big_endian_ulint() { let src = r#"FUNCTION main : ULINT main := TO_BIG_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -269,7 +269,7 @@ fn test_to_big_endian_ulint() { fn test_to_little_endian_ulint() { let src = r#"FUNCTION main : ULINT main := TO_LITTLE_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -281,7 +281,7 @@ fn test_to_little_endian_ulint() { fn test_from_big_endian_ulint() { let src = r#"FUNCTION main : ULINT main := FROM_BIG_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -293,7 +293,7 @@ fn test_from_big_endian_ulint() { fn test_from_little_endian_ulint() { let src = r#"FUNCTION main : ULINT main := FROM_LITTLE_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -306,7 +306,7 @@ fn test_from_little_endian_ulint() { fn test_to_big_endian_f32() { let src = r#"FUNCTION main : REAL main := TO_BIG_ENDIAN(REAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -318,7 +318,7 @@ fn test_to_big_endian_f32() { fn test_to_little_endian_f32() { let src = r#"FUNCTION main : REAL main := TO_LITTLE_ENDIAN(REAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -330,7 +330,7 @@ fn test_to_little_endian_f32() { fn test_from_big_endian_f32() { let src = r#"FUNCTION main : REAL main := FROM_BIG_ENDIAN(REAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -342,7 +342,7 @@ fn test_from_big_endian_f32() { fn test_from_little_endian_f32() { let src = r#"FUNCTION main : REAL main := FROM_LITTLE_ENDIAN(REAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -355,7 +355,7 @@ fn test_from_little_endian_f32() { fn test_to_big_endian_f64() { let src = r#"FUNCTION main : LREAL main := TO_BIG_ENDIAN(LREAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -367,7 +367,7 @@ fn test_to_big_endian_f64() { fn test_to_little_endian_f64() { let src = r#"FUNCTION main : LREAL main := TO_LITTLE_ENDIAN(LREAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -379,7 +379,7 @@ fn test_to_little_endian_f64() { fn test_from_big_endian_f64() { let src = r#"FUNCTION main : LREAL main := FROM_BIG_ENDIAN(LREAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -391,7 +391,7 @@ fn test_from_big_endian_f64() { fn test_from_little_endian_f64() { let src = r#"FUNCTION main : LREAL main := FROM_LITTLE_ENDIAN(LREAL#12.5); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -404,7 +404,7 @@ fn test_from_little_endian_f64() { fn test_to_big_endian_word() { let src = r#"FUNCTION main : WORD main := TO_BIG_ENDIAN(WORD#16#ABBA); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -416,7 +416,7 @@ fn test_to_big_endian_word() { fn test_to_little_endian_word() { let src = r#"FUNCTION main : WORD main := TO_LITTLE_ENDIAN(WORD#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -428,7 +428,7 @@ fn test_to_little_endian_word() { fn test_from_big_endian_word() { let src = r#"FUNCTION main : WORD main := FROM_BIG_ENDIAN(WORD#16#1001); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -440,7 +440,7 @@ fn test_from_big_endian_word() { fn test_from_little_endian_word() { let src = r#"FUNCTION main : WORD main := FROM_LITTLE_ENDIAN(WORD#16#ABBA); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -453,7 +453,7 @@ fn test_from_little_endian_word() { fn test_to_big_endian_dword() { let src = r#"FUNCTION main : UDINT main := TO_BIG_ENDIAN(UDINT#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -465,7 +465,7 @@ fn test_to_big_endian_dword() { fn test_to_little_endian_dword() { let src = r#"FUNCTION main : DWORD main := TO_LITTLE_ENDIAN(DWORD#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -477,7 +477,7 @@ fn test_to_little_endian_dword() { fn test_from_big_endian_dword() { let src = r#"FUNCTION main : DWORD main := FROM_BIG_ENDIAN(DWORD#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -489,7 +489,7 @@ fn test_from_big_endian_dword() { fn test_from_little_endian_dword() { let src = r#"FUNCTION main : DWORD main := FROM_LITTLE_ENDIAN(DWORD#16#10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -502,7 +502,7 @@ fn test_from_little_endian_dword() { fn test_to_big_endian_lword() { let src = r#"FUNCTION main : LWORD main := TO_BIG_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -514,7 +514,7 @@ fn test_to_big_endian_lword() { fn test_to_little_endian_lword() { let src = r#"FUNCTION main : LWORD main := TO_LITTLE_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -526,7 +526,7 @@ fn test_to_little_endian_lword() { fn test_from_big_endian_lword() { let src = r#"FUNCTION main : LWORD main := FROM_BIG_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -538,7 +538,7 @@ fn test_from_big_endian_lword() { fn test_from_little_endian_lword() { let src = r#"FUNCTION main : LWORD main := FROM_LITTLE_ENDIAN(LINT#16#10010A0B10010A0B); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -551,7 +551,7 @@ fn test_from_little_endian_lword() { fn test_to_big_endian_wchar() { let src = r#"FUNCTION main : WCHAR main := TO_BIG_ENDIAN(WCHAR#'C'); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -563,7 +563,7 @@ fn test_to_big_endian_wchar() { fn test_to_little_endian_wchar() { let src = r#"FUNCTION main : WCHAR main := TO_LITTLE_ENDIAN(WCHAR#'C'); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -575,7 +575,7 @@ fn test_to_little_endian_wchar() { fn test_from_big_endian_wchar() { let src = r#"FUNCTION main : WCHAR main := FROM_BIG_ENDIAN(WCHAR#'C'); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -587,7 +587,7 @@ fn test_from_big_endian_wchar() { fn test_from_little_endian_wchar() { let src = r#"FUNCTION main : WCHAR main := FROM_LITTLE_ENDIAN(WCHAR#'C'); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -600,7 +600,7 @@ fn test_from_little_endian_wchar() { fn test_to_big_endian_date() { let src = r#"FUNCTION main : DATE main := TO_BIG_ENDIAN(DATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); let res: i64 = compile_and_run_no_params(src); @@ -614,7 +614,7 @@ fn test_to_big_endian_date() { fn test_to_little_endian_date() { let src = r#"FUNCTION main : DATE main := TO_LITTLE_ENDIAN(DATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); let res: i64 = compile_and_run_no_params(src); @@ -628,7 +628,7 @@ fn test_to_little_endian_date() { fn test_from_big_endian_date() { let src = r#"FUNCTION main : DATE main := FROM_BIG_ENDIAN(DATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); let res: i64 = compile_and_run_no_params(src); @@ -644,7 +644,7 @@ fn test_from_big_endian_date() { fn test_from_little_endian_date() { let src = r#"FUNCTION main : DATE main := FROM_LITTLE_ENDIAN(DATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); let res: i64 = compile_and_run_no_params(src); @@ -661,7 +661,7 @@ fn test_from_little_endian_date() { fn test_to_big_endian_tod() { let src = r#"FUNCTION main : TIME_OF_DAY main := TO_BIG_ENDIAN(TIME_OF_DAY#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -673,7 +673,7 @@ fn test_to_big_endian_tod() { fn test_to_little_endian_tod() { let src = r#"FUNCTION main : TIME_OF_DAY main := TO_LITTLE_ENDIAN(TIME_OF_DAY#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -685,7 +685,7 @@ fn test_to_little_endian_tod() { fn test_from_big_endian_tod() { let src = r#"FUNCTION main : TIME_OF_DAY main := FROM_BIG_ENDIAN(TIME_OF_DAY#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -697,7 +697,7 @@ fn test_from_big_endian_tod() { fn test_from_little_endian_tod() { let src = r#"FUNCTION main : TIME_OF_DAY main := FROM_LITTLE_ENDIAN(TIME_OF_DAY#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -710,7 +710,7 @@ fn test_from_little_endian_tod() { fn test_to_big_endian_dt() { let src = r#"FUNCTION main : DATE_AND_TIME main := TO_BIG_ENDIAN(DATE_AND_TIME#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -725,7 +725,7 @@ fn test_to_big_endian_dt() { fn test_to_little_endian_dt() { let src = r#"FUNCTION main : DATE_AND_TIME main := TO_LITTLE_ENDIAN(DATE_AND_TIME#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -740,7 +740,7 @@ fn test_to_little_endian_dt() { fn test_from_big_endian_dt() { let src = r#"FUNCTION main : DATE_AND_TIME main := FROM_BIG_ENDIAN(DATE_AND_TIME#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -757,7 +757,7 @@ fn test_from_big_endian_dt() { fn test_from_little_endian_dt() { let src = r#"FUNCTION main : DATE_AND_TIME main := FROM_LITTLE_ENDIAN(DATE_AND_TIME#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -776,7 +776,7 @@ fn test_from_little_endian_dt() { fn test_to_big_endian_ldate_nanos() { let src = r#"FUNCTION main : LDATE main := TO_BIG_ENDIAN(LDATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -791,7 +791,7 @@ fn test_to_big_endian_ldate_nanos() { fn test_to_little_endian_ldate_nanos() { let src = r#"FUNCTION main : LDATE main := TO_LITTLE_ENDIAN(LDATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -806,7 +806,7 @@ fn test_to_little_endian_ldate_nanos() { fn test_from_big_endian_ldate_nanos() { let src = r#"FUNCTION main : LDATE main := FROM_BIG_ENDIAN(LDATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -823,7 +823,7 @@ fn test_from_big_endian_ldate_nanos() { fn test_from_little_endian_ldate_nanos() { let src = r#"FUNCTION main : LDATE main := FROM_LITTLE_ENDIAN(LDATE#1984-06-25); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -841,7 +841,7 @@ fn test_from_little_endian_ldate_nanos() { fn test_to_big_endian_ldt_nanos() { let src = r#"FUNCTION main : LDT main := TO_BIG_ENDIAN(LDT#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -862,7 +862,7 @@ fn test_to_big_endian_ldt_nanos() { fn test_to_little_endian_ldt_nanos() { let src = r#"FUNCTION main : LDT main := TO_LITTLE_ENDIAN(LDT#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -877,7 +877,7 @@ fn test_to_little_endian_ldt_nanos() { fn test_from_big_endian_nanos() { let src = r#"FUNCTION main : LDT main := FROM_BIG_ENDIAN(LDT#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -894,7 +894,7 @@ fn test_from_big_endian_nanos() { fn test_from_little_endian_nanos() { let src = r#"FUNCTION main : LDT main := FROM_LITTLE_ENDIAN(LDT#1984-06-25-00:00:00); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -912,7 +912,7 @@ fn test_from_little_endian_nanos() { fn test_to_big_endian_ltod_nanos() { let src = r#"FUNCTION main : LTOD main := TO_BIG_ENDIAN(LTOD#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -924,7 +924,7 @@ fn test_to_big_endian_ltod_nanos() { fn test_to_little_endian_ltod_nanos() { let src = r#"FUNCTION main : LTOD main := TO_LITTLE_ENDIAN(LTOD#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -936,7 +936,7 @@ fn test_to_little_endian_ltod_nanos() { fn test_from_big_endian_ltod_nanos() { let src = r#"FUNCTION main : LTOD main := FROM_BIG_ENDIAN(LTOD#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); @@ -948,7 +948,7 @@ fn test_from_big_endian_ltod_nanos() { fn test_from_little_endian_ltod_nanos() { let src = r#"FUNCTION main : LTOD main := FROM_LITTLE_ENDIAN(LTOD#22:22:22); - END_FUNCTION + END_FUNCTION "#; let src = add_std!(src, "endianness_conversion_functions.st"); diff --git a/libs/stdlib/tests/extra_function_tests.rs b/libs/stdlib/tests/extra_function_tests.rs index 8350749ae3..fcf93c56bc 100644 --- a/libs/stdlib/tests/extra_function_tests.rs +++ b/libs/stdlib/tests/extra_function_tests.rs @@ -439,7 +439,7 @@ fn real_to_string_conversion() { FUNCTION main : STRING VAR in: REAL := 13234.25; - END_VAR + END_VAR main := REAL_TO_STRING(in); END_FUNCTION "#; @@ -1590,7 +1590,7 @@ fn u64_to_ldate_signed_overflow() { let src = r#" FUNCTION main : DATE VAR - ul : ULINT := 9_223_372_036_854_775_807 + 1; //i64::MAX + 1 + ul : ULINT := 9_223_372_036_854_775_807 + 1; //i64::MAX + 1 END_VAR main := ULINT_TO_DATE(ul); END_FUNCTION @@ -1770,7 +1770,7 @@ fn dt_to_string_conversion() { FUNCTION main : STRING VAR in: DT := DT#1970-01-01-01:10:00; - END_VAR + END_VAR main := DT_TO_STRING(in); END_FUNCTION "#; @@ -1796,7 +1796,7 @@ fn dt_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: DT := DT#1970-01-01-01:10:00; - END_VAR + END_VAR main := DT_TO_WSTRING(in); END_FUNCTION "#; @@ -1849,7 +1849,7 @@ fn date_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: DATE := DATE#1970-01-01; - END_VAR + END_VAR main := DATE_TO_WSTRING(in); END_FUNCTION "#; @@ -1876,7 +1876,7 @@ fn time_to_string_conversion() { FUNCTION main : STRING VAR in: TIME := T#6d2m123ms456us789ns; - END_VAR + END_VAR main := TIME_TO_STRING(in); END_FUNCTION "#; @@ -1902,7 +1902,7 @@ fn time_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: TIME := T#6d3h2m9ns; - END_VAR + END_VAR main := TIME_TO_WSTRING(in); END_FUNCTION "#; @@ -1929,7 +1929,7 @@ fn tod_ltod_to_string_conversion() { FUNCTION main : STRING VAR in: TOD := TOD#15:36:55.123; - END_VAR + END_VAR main := TOD_TO_STRING(in); END_FUNCTION "#; @@ -1955,7 +1955,7 @@ fn tod_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: TOD := TOD#15:36:55.123; - END_VAR + END_VAR main := TOD_TO_WSTRING(in); END_FUNCTION "#; @@ -1982,7 +1982,7 @@ fn ldt_to_string_conversion() { FUNCTION main : STRING VAR in: LDT := LDT#1970-01-01-01:10:00; - END_VAR + END_VAR main := LDT_TO_STRING(in); END_FUNCTION "#; @@ -2008,7 +2008,7 @@ fn ldt_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: LDT := LDT#1970-01-01-01:10:00; - END_VAR + END_VAR main := LDT_TO_WSTRING(in); END_FUNCTION "#; @@ -2061,7 +2061,7 @@ fn ldate_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: LDATE := LDATE#1970-01-01; - END_VAR + END_VAR main := LDATE_TO_WSTRING(in); END_FUNCTION "#; @@ -2088,7 +2088,7 @@ fn ltime_to_string_conversion() { FUNCTION main : STRING VAR in: LTIME := LT#6d3h2m9ns; - END_VAR + END_VAR main := LTIME_TO_STRING(in); END_FUNCTION "#; @@ -2114,7 +2114,7 @@ fn ltime_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: LTIME := LT#6d3h2m9ns; - END_VAR + END_VAR main := LTIME_TO_WSTRING(in); END_FUNCTION "#; @@ -2141,7 +2141,7 @@ fn ltod_to_string_conversion() { FUNCTION main : STRING VAR in: LTOD := LTOD#15:36:55.123; - END_VAR + END_VAR main := LTOD_TO_STRING(in); END_FUNCTION "#; @@ -2167,7 +2167,7 @@ fn ltod_to_wstring_conversion() { FUNCTION main : WSTRING VAR in: LTOD := LTOD#15:36:55.123; - END_VAR + END_VAR main := LTOD_TO_WSTRING(in); END_FUNCTION "#; diff --git a/libs/stdlib/tests/num_conversion_tests.rs b/libs/stdlib/tests/num_conversion_tests.rs index 89fa88b5b8..677dd20cbe 100644 --- a/libs/stdlib/tests/num_conversion_tests.rs +++ b/libs/stdlib/tests/num_conversion_tests.rs @@ -119,17 +119,17 @@ struct F64Type { #[test] fn lreal_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_REAL(LREAL#0.0); - ret.negative := LREAL_to_REAL(LREAL#-1.7e+10); - ret.positive := LREAL_to_REAL(LREAL#1.7e+10); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_REAL(LREAL#0.0); + ret.negative := LREAL_to_REAL(LREAL#-1.7e+10); + ret.positive := LREAL_to_REAL(LREAL#1.7e+10); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -143,17 +143,17 @@ fn lreal_to_real_conversion() { #[test] fn lreal_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_LINT(LREAL#0.0); - ret.negative := LREAL_to_LINT(LREAL#-9.2233714871e+18); - ret.positive := LREAL_to_LINT(LREAL#9.2233714871e+18); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_LINT(LREAL#0.0); + ret.negative := LREAL_to_LINT(LREAL#-9.2233714871e+18); + ret.positive := LREAL_to_LINT(LREAL#9.2233714871e+18); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -167,17 +167,17 @@ fn lreal_to_lint_conversion() { #[test] fn lreal_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_DINT(LREAL#0.4); - ret.negative := LREAL_to_DINT(LREAL#-2.147483520e+9); - ret.positive := LREAL_to_DINT(LREAL#2.147483520e+9); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_DINT(LREAL#0.4); + ret.negative := LREAL_to_DINT(LREAL#-2.147483520e+9); + ret.positive := LREAL_to_DINT(LREAL#2.147483520e+9); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -191,17 +191,17 @@ fn lreal_to_dint_conversion() { #[test] fn lreal_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_INT(LREAL#-0.3); - ret.negative := LREAL_to_INT(LREAL#-3.2767e+4); - ret.positive := LREAL_to_INT(LREAL#3.2767e+4); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_INT(LREAL#-0.3); + ret.negative := LREAL_to_INT(LREAL#-3.2767e+4); + ret.positive := LREAL_to_INT(LREAL#3.2767e+4); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -215,17 +215,17 @@ fn lreal_to_int_conversion() { #[test] fn lreal_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_SINT(LREAL#0.4); - ret.negative := LREAL_to_SINT(LREAL#-1.27e+2); - ret.positive := LREAL_to_SINT(LREAL#1.27e+2); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_SINT(LREAL#0.4); + ret.negative := LREAL_to_SINT(LREAL#-1.27e+2); + ret.positive := LREAL_to_SINT(LREAL#1.27e+2); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -245,16 +245,16 @@ fn lreal_to_ulint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : ULINT; positive : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; positive : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_ULINT(LREAL#0.2); - ret.positive := LREAL_to_ULINT(LREAL#1.84467429742e+19); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_ULINT(LREAL#0.2); + ret.positive := LREAL_to_ULINT(LREAL#1.84467429742e+19); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -273,16 +273,16 @@ fn lreal_to_udint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : UDINT; positive : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; positive : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_UDINT(LREAL#0.4); - ret.positive := LREAL_to_UDINT(LREAL#4.294967040e+9); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_UDINT(LREAL#0.4); + ret.positive := LREAL_to_UDINT(LREAL#4.294967040e+9); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -301,16 +301,16 @@ fn lreal_to_uint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : UINT; positive : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; positive : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_UINT(LREAL#0.4); - ret.positive := LREAL_to_UINT(LREAL#6.5535e+4); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_UINT(LREAL#0.4); + ret.positive := LREAL_to_UINT(LREAL#6.5535e+4); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -329,16 +329,16 @@ fn lreal_to_usint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : USINT; positive : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; positive : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LREAL_to_USINT(LREAL#0.3); - ret.positive := LREAL_to_USINT(LREAL#2.25e+2); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LREAL_to_USINT(LREAL#0.3); + ret.positive := LREAL_to_USINT(LREAL#2.25e+2); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -351,17 +351,17 @@ fn lreal_to_usint_conversion() { #[test] fn real_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_LREAL(REAL#0.0); - ret.negative := REAL_to_LREAL(REAL#-2.2e+5); - ret.positive := REAL_to_LREAL(REAL#2.2e+5); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_LREAL(REAL#0.0); + ret.negative := REAL_to_LREAL(REAL#-2.2e+5); + ret.positive := REAL_to_LREAL(REAL#2.2e+5); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -375,17 +375,17 @@ fn real_to_lreal_conversion() { #[test] fn real_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_LINT(REAL#0.2); - ret.negative := REAL_to_LINT(REAL#-9.2233714871e+18); - ret.positive := REAL_to_LINT(REAL#9.2233714871e+18); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_LINT(REAL#0.2); + ret.negative := REAL_to_LINT(REAL#-9.2233714871e+18); + ret.positive := REAL_to_LINT(REAL#9.2233714871e+18); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -399,17 +399,17 @@ fn real_to_lint_conversion() { #[test] fn real_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_DINT(REAL#0.2); - ret.negative := REAL_to_DINT(REAL#-2.147483520e+9); - ret.positive := REAL_to_DINT(REAL#2.147483520e+9); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_DINT(REAL#0.2); + ret.negative := REAL_to_DINT(REAL#-2.147483520e+9); + ret.positive := REAL_to_DINT(REAL#2.147483520e+9); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -423,17 +423,17 @@ fn real_to_dint_conversion() { #[test] fn real_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_INT(REAL#0.3); - ret.negative := REAL_to_INT(REAL#-3.2767e+4); - ret.positive := REAL_to_INT(REAL#3.2767e+4); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_INT(REAL#0.3); + ret.negative := REAL_to_INT(REAL#-3.2767e+4); + ret.positive := REAL_to_INT(REAL#3.2767e+4); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -447,17 +447,17 @@ fn real_to_int_conversion() { #[test] fn real_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_SINT(REAL#0.2); - ret.negative := REAL_to_SINT(REAL#-1.27e+2); - ret.positive := REAL_to_SINT(REAL#1.27e+2); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_SINT(REAL#0.2); + ret.negative := REAL_to_SINT(REAL#-1.27e+2); + ret.positive := REAL_to_SINT(REAL#1.27e+2); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -477,16 +477,16 @@ fn real_to_ulint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : ULINT; positive : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; positive : ULINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_ULINT(REAL#0.1); - ret.positive := REAL_to_ULINT(REAL#1.84467429742e+19); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_ULINT(REAL#0.1); + ret.positive := REAL_to_ULINT(REAL#1.84467429742e+19); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -505,16 +505,16 @@ fn real_to_udint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : UDINT; positive : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; positive : UDINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_UDINT(REAL#0.2); - ret.positive := REAL_to_UDINT(REAL#4.294967040e+9); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_UDINT(REAL#0.2); + ret.positive := REAL_to_UDINT(REAL#4.294967040e+9); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -533,16 +533,16 @@ fn real_to_uint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : UINT; positive : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; positive : UINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_UINT(REAL#0.4); - ret.positive := REAL_to_UINT(REAL#6.5535e+4); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_UINT(REAL#0.4); + ret.positive := REAL_to_UINT(REAL#6.5535e+4); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -561,16 +561,16 @@ fn real_to_usint_conversion() { } let src = r" - TYPE myType : STRUCT - zero : USINT; positive : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; positive : USINT; + END_STRUCT END_TYPE - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := REAL_to_USINT(REAL#0.2); - ret.positive := REAL_to_USINT(REAL#2.25e+2); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := REAL_to_USINT(REAL#0.2); + ret.positive := REAL_to_USINT(REAL#2.25e+2); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -583,27 +583,27 @@ fn real_to_usint_conversion() { #[test] fn lint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 9223372036854775807; - MIN : LINT := -9223372036854775808; - END_VAR + VAR_GLOBAL + MAX : LINT := 9223372036854775807; + MIN : LINT := -9223372036854775808; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_LREAL(LINT#0); - ret.negative := LINT_to_LREAL(LINT#-11); - ret.positive := LINT_to_LREAL(LINT#22); - ret.max_minus_one := LINT_to_LREAL(MAX-1); - ret.min_plus_one := LINT_to_LREAL(MIN+1); - ret.max_overflow := LINT_to_LREAL(MAX+1); - ret.min_overflow := LINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_LREAL(LINT#0); + ret.negative := LINT_to_LREAL(LINT#-11); + ret.positive := LINT_to_LREAL(LINT#22); + ret.max_minus_one := LINT_to_LREAL(MAX-1); + ret.min_plus_one := LINT_to_LREAL(MIN+1); + ret.max_overflow := LINT_to_LREAL(MAX+1); + ret.min_overflow := LINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -621,27 +621,27 @@ fn lint_to_lreal_conversion() { #[test] fn lint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 9223372036854775807; - MIN : LINT := -9223372036854775808; - END_VAR + VAR_GLOBAL + MAX : LINT := 9223372036854775807; + MIN : LINT := -9223372036854775808; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_REAL(LINT#0); - ret.negative := LINT_to_REAL(LINT#-11); - ret.positive := LINT_to_REAL(LINT#22); - ret.max_minus_one := LINT_to_REAL(MAX-1); - ret.min_plus_one := LINT_to_REAL(MIN+1); - ret.max_overflow := LINT_to_REAL(MAX+1); - ret.min_overflow := LINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_REAL(LINT#0); + ret.negative := LINT_to_REAL(LINT#-11); + ret.positive := LINT_to_REAL(LINT#22); + ret.max_minus_one := LINT_to_REAL(MAX-1); + ret.min_plus_one := LINT_to_REAL(MIN+1); + ret.max_overflow := LINT_to_REAL(MAX+1); + ret.min_overflow := LINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -659,27 +659,27 @@ fn lint_to_real_conversion() { #[test] fn lint_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE - - VAR_GLOBAL - MAX : LINT := 2147483647; - MIN : LINT := -2147483648; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_DINT(LINT#0); - ret.negative := LINT_to_DINT(LINT#-11); - ret.positive := LINT_to_DINT(LINT#22); - ret.max_minus_one := LINT_to_DINT(MAX-1); - ret.min_plus_one := LINT_to_DINT(MIN+1); - ret.max_overflow := LINT_to_DINT(MAX+1); - ret.min_overflow := LINT_to_DINT(MIN-1); + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE + + VAR_GLOBAL + MAX : LINT := 2147483647; + MIN : LINT := -2147483648; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_DINT(LINT#0); + ret.negative := LINT_to_DINT(LINT#-11); + ret.positive := LINT_to_DINT(LINT#22); + ret.max_minus_one := LINT_to_DINT(MAX-1); + ret.min_plus_one := LINT_to_DINT(MIN+1); + ret.max_overflow := LINT_to_DINT(MAX+1); + ret.min_overflow := LINT_to_DINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -697,27 +697,27 @@ fn lint_to_dint_conversion() { #[test] fn lint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 32767; - MIN : LINT := -32768; - END_VAR + VAR_GLOBAL + MAX : LINT := 32767; + MIN : LINT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_INT(LINT#0); - ret.negative := LINT_to_INT(LINT#-11); - ret.positive := LINT_to_INT(LINT#22); - ret.max_minus_one := LINT_to_INT(MAX-1); - ret.min_plus_one := LINT_to_INT(MIN+1); - ret.max_overflow := LINT_to_INT(MAX+1); - ret.min_overflow := LINT_to_INT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_INT(LINT#0); + ret.negative := LINT_to_INT(LINT#-11); + ret.positive := LINT_to_INT(LINT#22); + ret.max_minus_one := LINT_to_INT(MAX-1); + ret.min_plus_one := LINT_to_INT(MIN+1); + ret.max_overflow := LINT_to_INT(MAX+1); + ret.min_overflow := LINT_to_INT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -735,27 +735,27 @@ fn lint_to_int_conversion() { #[test] fn lint_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 127; - MIN : LINT := -128; - END_VAR + VAR_GLOBAL + MAX : LINT := 127; + MIN : LINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_SINT(LINT#0); - ret.negative := LINT_to_SINT(LINT#-11); - ret.positive := LINT_to_SINT(LINT#22); - ret.max_minus_one := LINT_to_SINT(MAX-1); - ret.min_plus_one := LINT_to_SINT(MIN+1); - ret.max_overflow := LINT_to_SINT(MAX+1); - ret.min_overflow := LINT_to_SINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_SINT(LINT#0); + ret.negative := LINT_to_SINT(LINT#-11); + ret.positive := LINT_to_SINT(LINT#22); + ret.max_minus_one := LINT_to_SINT(MAX-1); + ret.min_plus_one := LINT_to_SINT(MIN+1); + ret.max_overflow := LINT_to_SINT(MAX+1); + ret.min_overflow := LINT_to_SINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -773,27 +773,27 @@ fn lint_to_sint_conversion() { #[test] fn lint_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 9223372036854775807; - MIN : LINT := -9223372036854775808; - END_VAR + VAR_GLOBAL + MAX : LINT := 9223372036854775807; + MIN : LINT := -9223372036854775808; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_ULINT(LINT#0); - ret.negative := LINT_to_ULINT(LINT#-1); - ret.positive := LINT_to_ULINT(LINT#22); - ret.max_minus_one := LINT_to_ULINT(MAX-1); - ret.min_plus_one := LINT_to_ULINT(MIN+1); - ret.max_overflow := LINT_to_ULINT(MAX+1); - ret.min_overflow := LINT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_ULINT(LINT#0); + ret.negative := LINT_to_ULINT(LINT#-1); + ret.positive := LINT_to_ULINT(LINT#22); + ret.max_minus_one := LINT_to_ULINT(MAX-1); + ret.min_plus_one := LINT_to_ULINT(MIN+1); + ret.max_overflow := LINT_to_ULINT(MAX+1); + ret.min_overflow := LINT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -811,27 +811,27 @@ fn lint_to_ulint_conversion() { #[test] fn lint_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 4294967295; - MIN : LINT := 0; - END_VAR + VAR_GLOBAL + MAX : LINT := 4294967295; + MIN : LINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_UDINT(LINT#0); - ret.negative := LINT_to_UDINT(LINT#-1); - ret.positive := LINT_to_UDINT(LINT#22); - ret.max_minus_one := LINT_to_UDINT(MAX-1); - ret.min_plus_one := LINT_to_UDINT(MIN+1); - ret.max_overflow := LINT_to_UDINT(MAX+1); - ret.min_overflow := LINT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_UDINT(LINT#0); + ret.negative := LINT_to_UDINT(LINT#-1); + ret.positive := LINT_to_UDINT(LINT#22); + ret.max_minus_one := LINT_to_UDINT(MAX-1); + ret.min_plus_one := LINT_to_UDINT(MIN+1); + ret.max_overflow := LINT_to_UDINT(MAX+1); + ret.min_overflow := LINT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -849,27 +849,27 @@ fn lint_to_udint_conversion() { #[test] fn lint_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 65535; - MIN : LINT := 0; - END_VAR + VAR_GLOBAL + MAX : LINT := 65535; + MIN : LINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_UINT(LINT#0); - ret.negative := LINT_to_UINT(LINT#-1); - ret.positive := LINT_to_UINT(LINT#22); - ret.max_minus_one := LINT_to_UINT(MAX-1); - ret.min_plus_one := LINT_to_UINT(MIN+1); - ret.max_overflow := LINT_to_UINT(MAX+1); - ret.min_overflow := LINT_to_UINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_UINT(LINT#0); + ret.negative := LINT_to_UINT(LINT#-1); + ret.positive := LINT_to_UINT(LINT#22); + ret.max_minus_one := LINT_to_UINT(MAX-1); + ret.min_plus_one := LINT_to_UINT(MIN+1); + ret.max_overflow := LINT_to_UINT(MAX+1); + ret.min_overflow := LINT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -887,27 +887,27 @@ fn lint_to_uint_conversion() { #[test] fn lint_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : LINT := 255; - MIN : LINT := 0; - END_VAR + VAR_GLOBAL + MAX : LINT := 255; + MIN : LINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := LINT_to_USINT(LINT#0); - ret.negative := LINT_to_USINT(LINT#-1); - ret.positive := LINT_to_USINT(LINT#22); - ret.max_minus_one := LINT_to_USINT(MAX-1); - ret.min_plus_one := LINT_to_USINT(MIN+1); - ret.max_overflow := LINT_to_USINT(MAX+1); - ret.min_overflow := LINT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := LINT_to_USINT(LINT#0); + ret.negative := LINT_to_USINT(LINT#-1); + ret.positive := LINT_to_USINT(LINT#22); + ret.max_minus_one := LINT_to_USINT(MAX-1); + ret.min_plus_one := LINT_to_USINT(MIN+1); + ret.max_overflow := LINT_to_USINT(MAX+1); + ret.min_overflow := LINT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -925,27 +925,27 @@ fn lint_to_usint_conversion() { #[test] fn dint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 2147483647; - MIN : DINT := -2147483648; - END_VAR + VAR_GLOBAL + MAX : DINT := 2147483647; + MIN : DINT := -2147483648; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_LREAL(DINT#0); - ret.negative := DINT_to_LREAL(DINT#-11); - ret.positive := DINT_to_LREAL(DINT#22); - ret.max_minus_one := DINT_to_LREAL(MAX-1); - ret.min_plus_one := DINT_to_LREAL(MIN+1); - ret.max_overflow := DINT_to_LREAL(MAX+1); - ret.min_overflow := DINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_LREAL(DINT#0); + ret.negative := DINT_to_LREAL(DINT#-11); + ret.positive := DINT_to_LREAL(DINT#22); + ret.max_minus_one := DINT_to_LREAL(MAX-1); + ret.min_plus_one := DINT_to_LREAL(MIN+1); + ret.max_overflow := DINT_to_LREAL(MAX+1); + ret.min_overflow := DINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -963,27 +963,27 @@ fn dint_to_lreal_conversion() { #[test] fn dint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 2147483647; - MIN : DINT := -2147483648; - END_VAR + VAR_GLOBAL + MAX : DINT := 2147483647; + MIN : DINT := -2147483648; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_REAL(DINT#0); - ret.negative := DINT_to_REAL(DINT#-11); - ret.positive := DINT_to_REAL(DINT#22); - ret.max_minus_one := DINT_to_REAL(MAX-1); - ret.min_plus_one := DINT_to_REAL(MIN+1); - ret.max_overflow := DINT_to_REAL(MAX+1); - ret.min_overflow := DINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_REAL(DINT#0); + ret.negative := DINT_to_REAL(DINT#-11); + ret.positive := DINT_to_REAL(DINT#22); + ret.max_minus_one := DINT_to_REAL(MAX-1); + ret.min_plus_one := DINT_to_REAL(MIN+1); + ret.max_overflow := DINT_to_REAL(MAX+1); + ret.min_overflow := DINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1001,27 +1001,27 @@ fn dint_to_real_conversion() { #[test] fn dint_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 2147483647; - MIN : DINT := -2147483648; - END_VAR + VAR_GLOBAL + MAX : DINT := 2147483647; + MIN : DINT := -2147483648; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_LINT(DINT#0); - ret.negative := DINT_to_LINT(DINT#-11); - ret.positive := DINT_to_LINT(DINT#22); - ret.max_minus_one := DINT_to_LINT(MAX-1); - ret.min_plus_one := DINT_to_LINT(MIN+1); - ret.max_overflow := DINT_to_LINT(MAX+1); - ret.min_overflow := DINT_to_LINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_LINT(DINT#0); + ret.negative := DINT_to_LINT(DINT#-11); + ret.positive := DINT_to_LINT(DINT#22); + ret.max_minus_one := DINT_to_LINT(MAX-1); + ret.min_plus_one := DINT_to_LINT(MIN+1); + ret.max_overflow := DINT_to_LINT(MAX+1); + ret.min_overflow := DINT_to_LINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1039,27 +1039,27 @@ fn dint_to_lint_conversion() { #[test] fn dint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 32767; - MIN : DINT := -32768; - END_VAR + VAR_GLOBAL + MAX : DINT := 32767; + MIN : DINT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_INT(DINT#0); - ret.negative := DINT_to_INT(DINT#-11); - ret.positive := DINT_to_INT(DINT#22); - ret.max_minus_one := DINT_to_INT(MAX-1); - ret.min_plus_one := DINT_to_INT(MIN+1); - ret.max_overflow := DINT_to_INT(MAX+1); - ret.min_overflow := DINT_to_INT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_INT(DINT#0); + ret.negative := DINT_to_INT(DINT#-11); + ret.positive := DINT_to_INT(DINT#22); + ret.max_minus_one := DINT_to_INT(MAX-1); + ret.min_plus_one := DINT_to_INT(MIN+1); + ret.max_overflow := DINT_to_INT(MAX+1); + ret.min_overflow := DINT_to_INT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1077,27 +1077,27 @@ fn dint_to_int_conversion() { #[test] fn dint_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 127; - MIN : DINT := -128; - END_VAR + VAR_GLOBAL + MAX : DINT := 127; + MIN : DINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_SINT(DINT#0); - ret.negative := DINT_to_SINT(DINT#-11); - ret.positive := DINT_to_SINT(DINT#22); - ret.max_minus_one := DINT_to_SINT(MAX-1); - ret.min_plus_one := DINT_to_SINT(MIN+1); - ret.max_overflow := DINT_to_SINT(MAX+1); - ret.min_overflow := DINT_to_SINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_SINT(DINT#0); + ret.negative := DINT_to_SINT(DINT#-11); + ret.positive := DINT_to_SINT(DINT#22); + ret.max_minus_one := DINT_to_SINT(MAX-1); + ret.min_plus_one := DINT_to_SINT(MIN+1); + ret.max_overflow := DINT_to_SINT(MAX+1); + ret.min_overflow := DINT_to_SINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1115,27 +1115,27 @@ fn dint_to_sint_conversion() { #[test] fn dint_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 2147483647; - MIN : DINT := -2147483648; - END_VAR + VAR_GLOBAL + MAX : DINT := 2147483647; + MIN : DINT := -2147483648; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_ULINT(DINT#0); - ret.negative := DINT_to_ULINT(DINT#-1); - ret.positive := DINT_to_ULINT(DINT#22); - ret.max_minus_one := DINT_to_ULINT(MAX-1); - ret.min_plus_one := DINT_to_ULINT(MIN+1); - ret.max_overflow := DINT_to_ULINT(MAX+1); - ret.min_overflow := DINT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_ULINT(DINT#0); + ret.negative := DINT_to_ULINT(DINT#-1); + ret.positive := DINT_to_ULINT(DINT#22); + ret.max_minus_one := DINT_to_ULINT(MAX-1); + ret.min_plus_one := DINT_to_ULINT(MIN+1); + ret.max_overflow := DINT_to_ULINT(MAX+1); + ret.min_overflow := DINT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1153,27 +1153,27 @@ fn dint_to_ulint_conversion() { #[test] fn dint_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 2147483647; - MIN : DINT := -2147483648; - END_VAR + VAR_GLOBAL + MAX : DINT := 2147483647; + MIN : DINT := -2147483648; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_UDINT(DINT#0); - ret.negative := DINT_to_UDINT(DINT#-1); - ret.positive := DINT_to_UDINT(DINT#22); - ret.max_minus_one := DINT_to_UDINT(MAX-1); - ret.min_plus_one := DINT_to_UDINT(MIN+1); - ret.max_overflow := DINT_to_UDINT(MAX+1); - ret.min_overflow := DINT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_UDINT(DINT#0); + ret.negative := DINT_to_UDINT(DINT#-1); + ret.positive := DINT_to_UDINT(DINT#22); + ret.max_minus_one := DINT_to_UDINT(MAX-1); + ret.min_plus_one := DINT_to_UDINT(MIN+1); + ret.max_overflow := DINT_to_UDINT(MAX+1); + ret.min_overflow := DINT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1191,27 +1191,27 @@ fn dint_to_udint_conversion() { #[test] fn dint_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 65535; - MIN : DINT := 0; - END_VAR + VAR_GLOBAL + MAX : DINT := 65535; + MIN : DINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_UINT(DINT#0); - ret.negative := DINT_to_UINT(DINT#-1); - ret.positive := DINT_to_UINT(DINT#22); - ret.max_minus_one := DINT_to_UINT(MAX-1); - ret.min_plus_one := DINT_to_UINT(MIN+1); - ret.max_overflow := DINT_to_UINT(MAX+1); - ret.min_overflow := DINT_to_UINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_UINT(DINT#0); + ret.negative := DINT_to_UINT(DINT#-1); + ret.positive := DINT_to_UINT(DINT#22); + ret.max_minus_one := DINT_to_UINT(MAX-1); + ret.min_plus_one := DINT_to_UINT(MIN+1); + ret.max_overflow := DINT_to_UINT(MAX+1); + ret.min_overflow := DINT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1229,27 +1229,27 @@ fn dint_to_uint_conversion() { #[test] fn dint_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : DINT := 255; - MIN : DINT := 0; - END_VAR + VAR_GLOBAL + MAX : DINT := 255; + MIN : DINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := DINT_to_USINT(DINT#0); - ret.negative := DINT_to_USINT(DINT#-1); - ret.positive := DINT_to_USINT(DINT#22); - ret.max_minus_one := DINT_to_USINT(MAX-1); - ret.min_plus_one := DINT_to_USINT(MIN+1); - ret.max_overflow := DINT_to_USINT(MAX+1); - ret.min_overflow := DINT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := DINT_to_USINT(DINT#0); + ret.negative := DINT_to_USINT(DINT#-1); + ret.positive := DINT_to_USINT(DINT#22); + ret.max_minus_one := DINT_to_USINT(MAX-1); + ret.min_plus_one := DINT_to_USINT(MIN+1); + ret.max_overflow := DINT_to_USINT(MAX+1); + ret.min_overflow := DINT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1267,27 +1267,27 @@ fn dint_to_usint_conversion() { #[test] fn int_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_LREAL(INT#0); - ret.negative := INT_to_LREAL(INT#-11); - ret.positive := INT_to_LREAL(INT#22); - ret.max_minus_one := INT_to_LREAL(MAX-1); - ret.min_plus_one := INT_to_LREAL(MIN+1); - ret.max_overflow := INT_to_LREAL(MAX+1); - ret.min_overflow := INT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_LREAL(INT#0); + ret.negative := INT_to_LREAL(INT#-11); + ret.positive := INT_to_LREAL(INT#22); + ret.max_minus_one := INT_to_LREAL(MAX-1); + ret.min_plus_one := INT_to_LREAL(MIN+1); + ret.max_overflow := INT_to_LREAL(MAX+1); + ret.min_overflow := INT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1305,27 +1305,27 @@ fn int_to_lreal_conversion() { #[test] fn int_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_REAL(INT#0); - ret.negative := INT_to_REAL(INT#-11); - ret.positive := INT_to_REAL(INT#22); - ret.max_minus_one := INT_to_REAL(MAX-1); - ret.min_plus_one := INT_to_REAL(MIN+1); - ret.max_overflow := INT_to_REAL(MAX+1); - ret.min_overflow := INT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_REAL(INT#0); + ret.negative := INT_to_REAL(INT#-11); + ret.positive := INT_to_REAL(INT#22); + ret.max_minus_one := INT_to_REAL(MAX-1); + ret.min_plus_one := INT_to_REAL(MIN+1); + ret.max_overflow := INT_to_REAL(MAX+1); + ret.min_overflow := INT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1343,27 +1343,27 @@ fn int_to_real_conversion() { #[test] fn int_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_LINT(INT#0); - ret.negative := INT_to_LINT(INT#-11); - ret.positive := INT_to_LINT(INT#22); - ret.max_minus_one := INT_to_LINT(MAX-1); - ret.min_plus_one := INT_to_LINT(MIN+1); - ret.max_overflow := INT_to_LINT(MAX+1); - ret.min_overflow := INT_to_LINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_LINT(INT#0); + ret.negative := INT_to_LINT(INT#-11); + ret.positive := INT_to_LINT(INT#22); + ret.max_minus_one := INT_to_LINT(MAX-1); + ret.min_plus_one := INT_to_LINT(MIN+1); + ret.max_overflow := INT_to_LINT(MAX+1); + ret.min_overflow := INT_to_LINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1381,27 +1381,27 @@ fn int_to_lint_conversion() { #[test] fn int_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_DINT(INT#0); - ret.negative := INT_to_DINT(INT#-11); - ret.positive := INT_to_DINT(INT#22); - ret.max_minus_one := INT_to_DINT(MAX-1); - ret.min_plus_one := INT_to_DINT(MIN+1); - ret.max_overflow := INT_to_DINT(MAX+1); - ret.min_overflow := INT_to_DINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_DINT(INT#0); + ret.negative := INT_to_DINT(INT#-11); + ret.positive := INT_to_DINT(INT#22); + ret.max_minus_one := INT_to_DINT(MAX-1); + ret.min_plus_one := INT_to_DINT(MIN+1); + ret.max_overflow := INT_to_DINT(MAX+1); + ret.min_overflow := INT_to_DINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1419,27 +1419,27 @@ fn int_to_dint_conversion() { #[test] fn int_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 127; - MIN : INT := -128; - END_VAR + VAR_GLOBAL + MAX : INT := 127; + MIN : INT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_SINT(INT#0); - ret.negative := INT_to_SINT(INT#-11); - ret.positive := INT_to_SINT(INT#22); - ret.max_minus_one := INT_to_SINT(MAX-1); - ret.min_plus_one := INT_to_SINT(MIN+1); - ret.max_overflow := INT_to_SINT(MAX+1); - ret.min_overflow := INT_to_SINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_SINT(INT#0); + ret.negative := INT_to_SINT(INT#-11); + ret.positive := INT_to_SINT(INT#22); + ret.max_minus_one := INT_to_SINT(MAX-1); + ret.min_plus_one := INT_to_SINT(MIN+1); + ret.max_overflow := INT_to_SINT(MAX+1); + ret.min_overflow := INT_to_SINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1457,27 +1457,27 @@ fn int_to_sint_conversion() { #[test] fn int_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_ULINT(INT#0); - ret.negative := INT_to_ULINT(INT#-1); - ret.positive := INT_to_ULINT(INT#22); - ret.max_minus_one := INT_to_ULINT(MAX-1); - ret.min_plus_one := INT_to_ULINT(MIN+1); - ret.max_overflow := INT_to_ULINT(MAX+1); - ret.min_overflow := INT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_ULINT(INT#0); + ret.negative := INT_to_ULINT(INT#-1); + ret.positive := INT_to_ULINT(INT#22); + ret.max_minus_one := INT_to_ULINT(MAX-1); + ret.min_plus_one := INT_to_ULINT(MIN+1); + ret.max_overflow := INT_to_ULINT(MAX+1); + ret.min_overflow := INT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1495,27 +1495,27 @@ fn int_to_ulint_conversion() { #[test] fn int_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_UDINT(INT#0); - ret.negative := INT_to_UDINT(INT#-1); - ret.positive := INT_to_UDINT(INT#22); - ret.max_minus_one := INT_to_UDINT(MAX-1); - ret.min_plus_one := INT_to_UDINT(MIN+1); - ret.max_overflow := INT_to_UDINT(MAX+1); - ret.min_overflow := INT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_UDINT(INT#0); + ret.negative := INT_to_UDINT(INT#-1); + ret.positive := INT_to_UDINT(INT#22); + ret.max_minus_one := INT_to_UDINT(MAX-1); + ret.min_plus_one := INT_to_UDINT(MIN+1); + ret.max_overflow := INT_to_UDINT(MAX+1); + ret.min_overflow := INT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1533,27 +1533,27 @@ fn int_to_udint_conversion() { #[test] fn int_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 32767; - MIN : INT := -32768; - END_VAR + VAR_GLOBAL + MAX : INT := 32767; + MIN : INT := -32768; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_UINT(INT#0); - ret.negative := INT_to_UINT(INT#-1); - ret.positive := INT_to_UINT(INT#22); - ret.max_minus_one := INT_to_UINT(MAX-1); - ret.min_plus_one := INT_to_UINT(MIN+1); - ret.max_overflow := INT_to_UINT(MAX+1); - ret.min_overflow := INT_to_UINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_UINT(INT#0); + ret.negative := INT_to_UINT(INT#-1); + ret.positive := INT_to_UINT(INT#22); + ret.max_minus_one := INT_to_UINT(MAX-1); + ret.min_plus_one := INT_to_UINT(MIN+1); + ret.max_overflow := INT_to_UINT(MAX+1); + ret.min_overflow := INT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1571,27 +1571,27 @@ fn int_to_uint_conversion() { #[test] fn int_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : INT := 255; - MIN : INT := 0; - END_VAR + VAR_GLOBAL + MAX : INT := 255; + MIN : INT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := INT_to_USINT(INT#0); - ret.negative := INT_to_USINT(INT#-1); - ret.positive := INT_to_USINT(INT#22); - ret.max_minus_one := INT_to_USINT(MAX-1); - ret.min_plus_one := INT_to_USINT(MIN+1); - ret.max_overflow := INT_to_USINT(MAX+1); - ret.min_overflow := INT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := INT_to_USINT(INT#0); + ret.negative := INT_to_USINT(INT#-1); + ret.positive := INT_to_USINT(INT#22); + ret.max_minus_one := INT_to_USINT(MAX-1); + ret.min_plus_one := INT_to_USINT(MIN+1); + ret.max_overflow := INT_to_USINT(MAX+1); + ret.min_overflow := INT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1609,27 +1609,27 @@ fn int_to_usint_conversion() { #[test] fn sint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_LREAL(SINT#0); - ret.negative := SINT_to_LREAL(SINT#-11); - ret.positive := SINT_to_LREAL(SINT#22); - ret.max_minus_one := SINT_to_LREAL(MAX-1); - ret.min_plus_one := SINT_to_LREAL(MIN+1); - ret.max_overflow := SINT_to_LREAL(MAX+1); - ret.min_overflow := SINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_LREAL(SINT#0); + ret.negative := SINT_to_LREAL(SINT#-11); + ret.positive := SINT_to_LREAL(SINT#22); + ret.max_minus_one := SINT_to_LREAL(MAX-1); + ret.min_plus_one := SINT_to_LREAL(MIN+1); + ret.max_overflow := SINT_to_LREAL(MAX+1); + ret.min_overflow := SINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1647,27 +1647,27 @@ fn sint_to_lreal_conversion() { #[test] fn sint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_REAL(SINT#0); - ret.negative := SINT_to_REAL(SINT#-11); - ret.positive := SINT_to_REAL(SINT#22); - ret.max_minus_one := SINT_to_REAL(MAX-1); - ret.min_plus_one := SINT_to_REAL(MIN+1); - ret.max_overflow := SINT_to_REAL(MAX+1); - ret.min_overflow := SINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_REAL(SINT#0); + ret.negative := SINT_to_REAL(SINT#-11); + ret.positive := SINT_to_REAL(SINT#22); + ret.max_minus_one := SINT_to_REAL(MAX-1); + ret.min_plus_one := SINT_to_REAL(MIN+1); + ret.max_overflow := SINT_to_REAL(MAX+1); + ret.min_overflow := SINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1685,27 +1685,27 @@ fn sint_to_real_conversion() { #[test] fn sint_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_LINT(SINT#0); - ret.negative := SINT_to_LINT(SINT#-11); - ret.positive := SINT_to_LINT(SINT#22); - ret.max_minus_one := SINT_to_LINT(MAX-1); - ret.min_plus_one := SINT_to_LINT(MIN+1); - ret.max_overflow := SINT_to_LINT(MAX+1); - ret.min_overflow := SINT_to_LINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_LINT(SINT#0); + ret.negative := SINT_to_LINT(SINT#-11); + ret.positive := SINT_to_LINT(SINT#22); + ret.max_minus_one := SINT_to_LINT(MAX-1); + ret.min_plus_one := SINT_to_LINT(MIN+1); + ret.max_overflow := SINT_to_LINT(MAX+1); + ret.min_overflow := SINT_to_LINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1723,27 +1723,27 @@ fn sint_to_lint_conversion() { #[test] fn sint_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_DINT(SINT#0); - ret.negative := SINT_to_DINT(SINT#-11); - ret.positive := SINT_to_DINT(SINT#22); - ret.max_minus_one := SINT_to_DINT(MAX-1); - ret.min_plus_one := SINT_to_DINT(MIN+1); - ret.max_overflow := SINT_to_DINT(MAX+1); - ret.min_overflow := SINT_to_DINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_DINT(SINT#0); + ret.negative := SINT_to_DINT(SINT#-11); + ret.positive := SINT_to_DINT(SINT#22); + ret.max_minus_one := SINT_to_DINT(MAX-1); + ret.min_plus_one := SINT_to_DINT(MIN+1); + ret.max_overflow := SINT_to_DINT(MAX+1); + ret.min_overflow := SINT_to_DINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1761,27 +1761,27 @@ fn sint_to_dint_conversion() { #[test] fn sint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_INT(SINT#0); - ret.negative := SINT_to_INT(SINT#-11); - ret.positive := SINT_to_INT(SINT#22); - ret.max_minus_one := SINT_to_INT(MAX-1); - ret.min_plus_one := SINT_to_INT(MIN+1); - ret.max_overflow := SINT_to_INT(MAX+1); - ret.min_overflow := SINT_to_INT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_INT(SINT#0); + ret.negative := SINT_to_INT(SINT#-11); + ret.positive := SINT_to_INT(SINT#22); + ret.max_minus_one := SINT_to_INT(MAX-1); + ret.min_plus_one := SINT_to_INT(MIN+1); + ret.max_overflow := SINT_to_INT(MAX+1); + ret.min_overflow := SINT_to_INT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1799,27 +1799,27 @@ fn sint_to_int_conversion() { #[test] fn sint_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_ULINT(SINT#0); - ret.negative := SINT_to_ULINT(SINT#-1); - ret.positive := SINT_to_ULINT(SINT#22); - ret.max_minus_one := SINT_to_ULINT(MAX-1); - ret.min_plus_one := SINT_to_ULINT(MIN+1); - ret.max_overflow := SINT_to_ULINT(MAX+1); - ret.min_overflow := SINT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_ULINT(SINT#0); + ret.negative := SINT_to_ULINT(SINT#-1); + ret.positive := SINT_to_ULINT(SINT#22); + ret.max_minus_one := SINT_to_ULINT(MAX-1); + ret.min_plus_one := SINT_to_ULINT(MIN+1); + ret.max_overflow := SINT_to_ULINT(MAX+1); + ret.min_overflow := SINT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1837,27 +1837,27 @@ fn sint_to_ulint_conversion() { #[test] fn sint_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_UDINT(SINT#0); - ret.negative := SINT_to_UDINT(SINT#-1); - ret.positive := SINT_to_UDINT(SINT#22); - ret.max_minus_one := SINT_to_UDINT(MAX-1); - ret.min_plus_one := SINT_to_UDINT(MIN+1); - ret.max_overflow := SINT_to_UDINT(MAX+1); - ret.min_overflow := SINT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_UDINT(SINT#0); + ret.negative := SINT_to_UDINT(SINT#-1); + ret.positive := SINT_to_UDINT(SINT#22); + ret.max_minus_one := SINT_to_UDINT(MAX-1); + ret.min_plus_one := SINT_to_UDINT(MIN+1); + ret.max_overflow := SINT_to_UDINT(MAX+1); + ret.min_overflow := SINT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1875,27 +1875,27 @@ fn sint_to_udint_conversion() { #[test] fn sint_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_UINT(SINT#0); - ret.negative := SINT_to_UINT(SINT#-1); - ret.positive := SINT_to_UINT(SINT#22); - ret.max_minus_one := SINT_to_UINT(MAX-1); - ret.min_plus_one := SINT_to_UINT(MIN+1); - ret.max_overflow := SINT_to_UINT(MAX+1); - ret.min_overflow := SINT_to_UINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_UINT(SINT#0); + ret.negative := SINT_to_UINT(SINT#-1); + ret.positive := SINT_to_UINT(SINT#22); + ret.max_minus_one := SINT_to_UINT(MAX-1); + ret.min_plus_one := SINT_to_UINT(MIN+1); + ret.max_overflow := SINT_to_UINT(MAX+1); + ret.min_overflow := SINT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1913,27 +1913,27 @@ fn sint_to_uint_conversion() { #[test] fn sint_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : SINT := 127; - MIN : SINT := -128; - END_VAR + VAR_GLOBAL + MAX : SINT := 127; + MIN : SINT := -128; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := SINT_to_USINT(SINT#0); - ret.negative := SINT_to_USINT(SINT#-1); - ret.positive := SINT_to_USINT(SINT#22); - ret.max_minus_one := SINT_to_USINT(MAX-1); - ret.min_plus_one := SINT_to_USINT(MIN+1); - ret.max_overflow := SINT_to_USINT(MAX+1); - ret.min_overflow := SINT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := SINT_to_USINT(SINT#0); + ret.negative := SINT_to_USINT(SINT#-1); + ret.positive := SINT_to_USINT(SINT#22); + ret.max_minus_one := SINT_to_USINT(MAX-1); + ret.min_plus_one := SINT_to_USINT(MIN+1); + ret.max_overflow := SINT_to_USINT(MAX+1); + ret.min_overflow := SINT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1951,27 +1951,27 @@ fn sint_to_usint_conversion() { #[test] fn ulint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 18446744073709551615; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 18446744073709551615; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_LREAL(ULINT#0); - ret.negative := ULINT_to_LREAL(-2); - ret.positive := ULINT_to_LREAL(ULINT#22); - ret.max_minus_one := ULINT_to_LREAL(MAX-1); - ret.min_plus_one := ULINT_to_LREAL(MIN+1); - ret.max_overflow := ULINT_to_LREAL(MAX+1); - ret.min_overflow := ULINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_LREAL(ULINT#0); + ret.negative := ULINT_to_LREAL(-2); + ret.positive := ULINT_to_LREAL(ULINT#22); + ret.max_minus_one := ULINT_to_LREAL(MAX-1); + ret.min_plus_one := ULINT_to_LREAL(MIN+1); + ret.max_overflow := ULINT_to_LREAL(MAX+1); + ret.min_overflow := ULINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -1989,27 +1989,27 @@ fn ulint_to_lreal_conversion() { #[test] fn ulint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 18446744073709551615; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 18446744073709551615; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_REAL(ULINT#0); - ret.negative := ULINT_to_REAL(-2); - ret.positive := ULINT_to_REAL(ULINT#22); - ret.max_minus_one := ULINT_to_REAL(MAX-1); - ret.min_plus_one := ULINT_to_REAL(MIN+1); - ret.max_overflow := ULINT_to_REAL(MAX+1); - ret.min_overflow := ULINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_REAL(ULINT#0); + ret.negative := ULINT_to_REAL(-2); + ret.positive := ULINT_to_REAL(ULINT#22); + ret.max_minus_one := ULINT_to_REAL(MAX-1); + ret.min_plus_one := ULINT_to_REAL(MIN+1); + ret.max_overflow := ULINT_to_REAL(MAX+1); + ret.min_overflow := ULINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2027,25 +2027,25 @@ fn ulint_to_real_conversion() { #[test] fn ulint_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 9223372036854775807; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 9223372036854775807; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_LINT(ULINT#0); - ret.positive := ULINT_to_LINT(ULINT#22); - ret.max_minus_one := ULINT_to_LINT(MAX-1); - ret.min_plus_one := ULINT_to_LINT(MIN+1); - ret.max_overflow := ULINT_to_LINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_LINT(ULINT#0); + ret.positive := ULINT_to_LINT(ULINT#22); + ret.max_minus_one := ULINT_to_LINT(MAX-1); + ret.min_plus_one := ULINT_to_LINT(MIN+1); + ret.max_overflow := ULINT_to_LINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2061,25 +2061,25 @@ fn ulint_to_lint_conversion() { #[test] fn ulint_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 2147483647; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 2147483647; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_DINT(ULINT#0); - ret.positive := ULINT_to_DINT(ULINT#22); - ret.max_minus_one := ULINT_to_DINT(MAX-1); - ret.min_plus_one := ULINT_to_DINT(MIN+1); - ret.max_overflow := ULINT_to_DINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_DINT(ULINT#0); + ret.positive := ULINT_to_DINT(ULINT#22); + ret.max_minus_one := ULINT_to_DINT(MAX-1); + ret.min_plus_one := ULINT_to_DINT(MIN+1); + ret.max_overflow := ULINT_to_DINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2095,25 +2095,25 @@ fn ulint_to_dint_conversion() { #[test] fn ulint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 32767; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 32767; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_INT(ULINT#0); - ret.positive := ULINT_to_INT(ULINT#22); - ret.max_minus_one := ULINT_to_INT(MAX-1); - ret.min_plus_one := ULINT_to_INT(MIN+1); - ret.max_overflow := ULINT_to_INT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_INT(ULINT#0); + ret.positive := ULINT_to_INT(ULINT#22); + ret.max_minus_one := ULINT_to_INT(MAX-1); + ret.min_plus_one := ULINT_to_INT(MIN+1); + ret.max_overflow := ULINT_to_INT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2129,25 +2129,25 @@ fn ulint_to_int_conversion() { #[test] fn ulint_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 127; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 127; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_SINT(ULINT#0); - ret.positive := ULINT_to_SINT(ULINT#22); - ret.max_minus_one := ULINT_to_SINT(MAX-1); - ret.min_plus_one := ULINT_to_SINT(MIN+1); - ret.max_overflow := ULINT_to_SINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_SINT(ULINT#0); + ret.positive := ULINT_to_SINT(ULINT#22); + ret.max_minus_one := ULINT_to_SINT(MAX-1); + ret.min_plus_one := ULINT_to_SINT(MIN+1); + ret.max_overflow := ULINT_to_SINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2163,27 +2163,27 @@ fn ulint_to_sint_conversion() { #[test] fn ulint_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 4294967295; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 4294967295; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_UDINT(ULINT#0); - ret.negative := ULINT_to_UDINT(-1); - ret.positive := ULINT_to_UDINT(ULINT#22); - ret.max_minus_one := ULINT_to_UDINT(MAX-1); - ret.min_plus_one := ULINT_to_UDINT(MIN+1); - ret.max_overflow := ULINT_to_UDINT(MAX+1); - ret.min_overflow := ULINT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_UDINT(ULINT#0); + ret.negative := ULINT_to_UDINT(-1); + ret.positive := ULINT_to_UDINT(ULINT#22); + ret.max_minus_one := ULINT_to_UDINT(MAX-1); + ret.min_plus_one := ULINT_to_UDINT(MIN+1); + ret.max_overflow := ULINT_to_UDINT(MAX+1); + ret.min_overflow := ULINT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2201,27 +2201,27 @@ fn ulint_to_udint_conversion() { #[test] fn ulint_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 65535; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 65535; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_UINT(ULINT#0); - ret.negative := ULINT_to_UINT(-1); - ret.positive := ULINT_to_UINT(ULINT#22); - ret.max_minus_one := ULINT_to_UINT(MAX-1); - ret.min_plus_one := ULINT_to_UINT(MIN+1); - ret.max_overflow := ULINT_to_UINT(MAX+1); - ret.min_overflow := ULINT_to_UINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_UINT(ULINT#0); + ret.negative := ULINT_to_UINT(-1); + ret.positive := ULINT_to_UINT(ULINT#22); + ret.max_minus_one := ULINT_to_UINT(MAX-1); + ret.min_plus_one := ULINT_to_UINT(MIN+1); + ret.max_overflow := ULINT_to_UINT(MAX+1); + ret.min_overflow := ULINT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2239,27 +2239,27 @@ fn ulint_to_uint_conversion() { #[test] fn ulint_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : ULINT := 255; - MIN : ULINT := 0; - END_VAR + VAR_GLOBAL + MAX : ULINT := 255; + MIN : ULINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := ULINT_to_USINT(ULINT#0); - ret.negative := ULINT_to_USINT(-1); - ret.positive := ULINT_to_USINT(ULINT#22); - ret.max_minus_one := ULINT_to_USINT(MAX-1); - ret.min_plus_one := ULINT_to_USINT(MIN+1); - ret.max_overflow := ULINT_to_USINT(MAX+1); - ret.min_overflow := ULINT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := ULINT_to_USINT(ULINT#0); + ret.negative := ULINT_to_USINT(-1); + ret.positive := ULINT_to_USINT(ULINT#22); + ret.max_minus_one := ULINT_to_USINT(MAX-1); + ret.min_plus_one := ULINT_to_USINT(MIN+1); + ret.max_overflow := ULINT_to_USINT(MAX+1); + ret.min_overflow := ULINT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2277,27 +2277,27 @@ fn ulint_to_usint_conversion() { #[test] fn udint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 4294967295; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 4294967295; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_LREAL(UDINT#0); - ret.negative := UDINT_to_LREAL(-2); - ret.positive := UDINT_to_LREAL(UDINT#22); - ret.max_minus_one := UDINT_to_LREAL(MAX-1); - ret.min_plus_one := UDINT_to_LREAL(MIN+1); - ret.max_overflow := UDINT_to_LREAL(MAX+1); - ret.min_overflow := UDINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_LREAL(UDINT#0); + ret.negative := UDINT_to_LREAL(-2); + ret.positive := UDINT_to_LREAL(UDINT#22); + ret.max_minus_one := UDINT_to_LREAL(MAX-1); + ret.min_plus_one := UDINT_to_LREAL(MIN+1); + ret.max_overflow := UDINT_to_LREAL(MAX+1); + ret.min_overflow := UDINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2315,27 +2315,27 @@ fn udint_to_lreal_conversion() { #[test] fn udint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 4294967295; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 4294967295; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_REAL(UDINT#0); - ret.negative := UDINT_to_REAL(-2); - ret.positive := UDINT_to_REAL(UDINT#22); - ret.max_minus_one := UDINT_to_REAL(MAX-1); - ret.min_plus_one := UDINT_to_REAL(MIN+1); - ret.max_overflow := UDINT_to_REAL(MAX+1); - ret.min_overflow := UDINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_REAL(UDINT#0); + ret.negative := UDINT_to_REAL(-2); + ret.positive := UDINT_to_REAL(UDINT#22); + ret.max_minus_one := UDINT_to_REAL(MAX-1); + ret.min_plus_one := UDINT_to_REAL(MIN+1); + ret.max_overflow := UDINT_to_REAL(MAX+1); + ret.min_overflow := UDINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2353,27 +2353,27 @@ fn udint_to_real_conversion() { #[test] fn udint_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 4294967295; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 4294967295; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_LINT(UDINT#0); - ret.negative := UDINT_to_LINT(-1); - ret.positive := UDINT_to_LINT(UDINT#22); - ret.max_minus_one := UDINT_to_LINT(MAX-1); - ret.min_plus_one := UDINT_to_LINT(MIN+1); - ret.max_overflow := UDINT_to_LINT(MAX+1); - ret.min_overflow := UDINT_to_LINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_LINT(UDINT#0); + ret.negative := UDINT_to_LINT(-1); + ret.positive := UDINT_to_LINT(UDINT#22); + ret.max_minus_one := UDINT_to_LINT(MAX-1); + ret.min_plus_one := UDINT_to_LINT(MIN+1); + ret.max_overflow := UDINT_to_LINT(MAX+1); + ret.min_overflow := UDINT_to_LINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2391,25 +2391,25 @@ fn udint_to_lint_conversion() { #[test] fn udint_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 2147483647; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 2147483647; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_DINT(UDINT#0); - ret.positive := UDINT_to_DINT(UDINT#22); - ret.max_minus_one := UDINT_to_DINT(MAX-1); - ret.min_plus_one := UDINT_to_DINT(MIN+1); - ret.max_overflow := UDINT_to_DINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_DINT(UDINT#0); + ret.positive := UDINT_to_DINT(UDINT#22); + ret.max_minus_one := UDINT_to_DINT(MAX-1); + ret.min_plus_one := UDINT_to_DINT(MIN+1); + ret.max_overflow := UDINT_to_DINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2425,25 +2425,25 @@ fn udint_to_dint_conversion() { #[test] fn udint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 32767; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 32767; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_INT(UDINT#0); - ret.positive := UDINT_to_INT(UDINT#22); - ret.max_minus_one := UDINT_to_INT(MAX-1); - ret.min_plus_one := UDINT_to_INT(MIN+1); - ret.max_overflow := UDINT_to_INT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_INT(UDINT#0); + ret.positive := UDINT_to_INT(UDINT#22); + ret.max_minus_one := UDINT_to_INT(MAX-1); + ret.min_plus_one := UDINT_to_INT(MIN+1); + ret.max_overflow := UDINT_to_INT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2459,25 +2459,25 @@ fn udint_to_int_conversion() { #[test] fn udint_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 127; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 127; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_SINT(UDINT#0); - ret.positive := UDINT_to_SINT(UDINT#22); - ret.max_minus_one := UDINT_to_SINT(MAX-1); - ret.min_plus_one := UDINT_to_SINT(MIN+1); - ret.max_overflow := UDINT_to_SINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_SINT(UDINT#0); + ret.positive := UDINT_to_SINT(UDINT#22); + ret.max_minus_one := UDINT_to_SINT(MAX-1); + ret.min_plus_one := UDINT_to_SINT(MIN+1); + ret.max_overflow := UDINT_to_SINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2493,27 +2493,27 @@ fn udint_to_sint_conversion() { #[test] fn udint_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 4294967295; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 4294967295; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_ULINT(UDINT#0); - ret.negative := UDINT_to_ULINT(-1); - ret.positive := UDINT_to_ULINT(UDINT#22); - ret.max_minus_one := UDINT_to_ULINT(MAX-1); - ret.min_plus_one := UDINT_to_ULINT(MIN+1); - ret.max_overflow := UDINT_to_ULINT(MAX+1); - ret.min_overflow := UDINT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_ULINT(UDINT#0); + ret.negative := UDINT_to_ULINT(-1); + ret.positive := UDINT_to_ULINT(UDINT#22); + ret.max_minus_one := UDINT_to_ULINT(MAX-1); + ret.min_plus_one := UDINT_to_ULINT(MIN+1); + ret.max_overflow := UDINT_to_ULINT(MAX+1); + ret.min_overflow := UDINT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2531,27 +2531,27 @@ fn udint_to_ulint_conversion() { #[test] fn udint_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 65535; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 65535; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_UINT(UDINT#0); - ret.negative := UDINT_to_UINT(-1); - ret.positive := UDINT_to_UINT(UDINT#22); - ret.max_minus_one := UDINT_to_UINT(MAX-1); - ret.min_plus_one := UDINT_to_UINT(MIN+1); - ret.max_overflow := UDINT_to_UINT(MAX+1); - ret.min_overflow := UDINT_to_UINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_UINT(UDINT#0); + ret.negative := UDINT_to_UINT(-1); + ret.positive := UDINT_to_UINT(UDINT#22); + ret.max_minus_one := UDINT_to_UINT(MAX-1); + ret.min_plus_one := UDINT_to_UINT(MIN+1); + ret.max_overflow := UDINT_to_UINT(MAX+1); + ret.min_overflow := UDINT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2569,27 +2569,27 @@ fn udint_to_uint_conversion() { #[test] fn udint_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UDINT := 255; - MIN : UDINT := 0; - END_VAR + VAR_GLOBAL + MAX : UDINT := 255; + MIN : UDINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UDINT_to_USINT(UDINT#0); - ret.negative := UDINT_to_USINT(-1); - ret.positive := UDINT_to_USINT(UDINT#22); - ret.max_minus_one := UDINT_to_USINT(MAX-1); - ret.min_plus_one := UDINT_to_USINT(MIN+1); - ret.max_overflow := UDINT_to_USINT(MAX+1); - ret.min_overflow := UDINT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UDINT_to_USINT(UDINT#0); + ret.negative := UDINT_to_USINT(-1); + ret.positive := UDINT_to_USINT(UDINT#22); + ret.max_minus_one := UDINT_to_USINT(MAX-1); + ret.min_plus_one := UDINT_to_USINT(MIN+1); + ret.max_overflow := UDINT_to_USINT(MAX+1); + ret.min_overflow := UDINT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2607,27 +2607,27 @@ fn udint_to_usint_conversion() { #[test] fn uint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 65535; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 65535; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_LREAL(UINT#0); - ret.negative := UINT_to_LREAL(-2); - ret.positive := UINT_to_LREAL(UINT#22); - ret.max_minus_one := UINT_to_LREAL(MAX-1); - ret.min_plus_one := UINT_to_LREAL(MIN+1); - ret.max_overflow := UINT_to_LREAL(MAX+1); - ret.min_overflow := UINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_LREAL(UINT#0); + ret.negative := UINT_to_LREAL(-2); + ret.positive := UINT_to_LREAL(UINT#22); + ret.max_minus_one := UINT_to_LREAL(MAX-1); + ret.min_plus_one := UINT_to_LREAL(MIN+1); + ret.max_overflow := UINT_to_LREAL(MAX+1); + ret.min_overflow := UINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2645,27 +2645,27 @@ fn uint_to_lreal_conversion() { #[test] fn uint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 65535; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 65535; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_REAL(UINT#0); - ret.negative := UINT_to_REAL(-2); - ret.positive := UINT_to_REAL(UINT#22); - ret.max_minus_one := UINT_to_REAL(MAX-1); - ret.min_plus_one := UINT_to_REAL(MIN+1); - ret.max_overflow := UINT_to_REAL(MAX+1); - ret.min_overflow := UINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_REAL(UINT#0); + ret.negative := UINT_to_REAL(-2); + ret.positive := UINT_to_REAL(UINT#22); + ret.max_minus_one := UINT_to_REAL(MAX-1); + ret.min_plus_one := UINT_to_REAL(MIN+1); + ret.max_overflow := UINT_to_REAL(MAX+1); + ret.min_overflow := UINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2683,27 +2683,27 @@ fn uint_to_real_conversion() { #[test] fn uint_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 65535; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 65535; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_LINT(UINT#0); - ret.negative := UINT_to_LINT(-1); - ret.positive := UINT_to_LINT(UINT#22); - ret.max_minus_one := UINT_to_LINT(MAX-1); - ret.min_plus_one := UINT_to_LINT(MIN+1); - ret.max_overflow := UINT_to_LINT(MAX+1); - ret.min_overflow := UINT_to_LINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_LINT(UINT#0); + ret.negative := UINT_to_LINT(-1); + ret.positive := UINT_to_LINT(UINT#22); + ret.max_minus_one := UINT_to_LINT(MAX-1); + ret.min_plus_one := UINT_to_LINT(MIN+1); + ret.max_overflow := UINT_to_LINT(MAX+1); + ret.min_overflow := UINT_to_LINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2721,27 +2721,27 @@ fn uint_to_lint_conversion() { #[test] fn uint_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 65535; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 65535; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_DINT(UINT#0); - ret.negative := UINT_to_DINT(-1); - ret.positive := UINT_to_DINT(UINT#22); - ret.max_minus_one := UINT_to_DINT(MAX-1); - ret.min_plus_one := UINT_to_DINT(MIN+1); - ret.max_overflow := UINT_to_DINT(MAX+1); - ret.min_overflow := UINT_to_DINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_DINT(UINT#0); + ret.negative := UINT_to_DINT(-1); + ret.positive := UINT_to_DINT(UINT#22); + ret.max_minus_one := UINT_to_DINT(MAX-1); + ret.min_plus_one := UINT_to_DINT(MIN+1); + ret.max_overflow := UINT_to_DINT(MAX+1); + ret.min_overflow := UINT_to_DINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2759,25 +2759,25 @@ fn uint_to_dint_conversion() { #[test] fn uint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 32767; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 32767; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_INT(UINT#0); - ret.positive := UINT_to_INT(UINT#22); - ret.max_minus_one := UINT_to_INT(MAX-1); - ret.min_plus_one := UINT_to_INT(MIN+1); - ret.max_overflow := UINT_to_INT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_INT(UINT#0); + ret.positive := UINT_to_INT(UINT#22); + ret.max_minus_one := UINT_to_INT(MAX-1); + ret.min_plus_one := UINT_to_INT(MIN+1); + ret.max_overflow := UINT_to_INT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2793,25 +2793,25 @@ fn uint_to_int_conversion() { #[test] fn uint_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 127; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 127; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_SINT(UINT#0); - ret.positive := UINT_to_SINT(UINT#22); - ret.max_minus_one := UINT_to_SINT(MAX-1); - ret.min_plus_one := UINT_to_SINT(MIN+1); - ret.max_overflow := UINT_to_SINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_SINT(UINT#0); + ret.positive := UINT_to_SINT(UINT#22); + ret.max_minus_one := UINT_to_SINT(MAX-1); + ret.min_plus_one := UINT_to_SINT(MIN+1); + ret.max_overflow := UINT_to_SINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2827,27 +2827,27 @@ fn uint_to_sint_conversion() { #[test] fn uint_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 65535; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 65535; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_ULINT(UINT#0); - ret.negative := UINT_to_ULINT(-1); - ret.positive := UINT_to_ULINT(UINT#22); - ret.max_minus_one := UINT_to_ULINT(MAX-1); - ret.min_plus_one := UINT_to_ULINT(MIN+1); - ret.max_overflow := UINT_to_ULINT(MAX+1); - ret.min_overflow := UINT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_ULINT(UINT#0); + ret.negative := UINT_to_ULINT(-1); + ret.positive := UINT_to_ULINT(UINT#22); + ret.max_minus_one := UINT_to_ULINT(MAX-1); + ret.min_plus_one := UINT_to_ULINT(MIN+1); + ret.max_overflow := UINT_to_ULINT(MAX+1); + ret.min_overflow := UINT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2865,27 +2865,27 @@ fn uint_to_ulint_conversion() { #[test] fn uint_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 65535; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 65535; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_UDINT(UINT#0); - ret.negative := UINT_to_UDINT(-1); - ret.positive := UINT_to_UDINT(UINT#22); - ret.max_minus_one := UINT_to_UDINT(MAX-1); - ret.min_plus_one := UINT_to_UDINT(MIN+1); - ret.max_overflow := UINT_to_UDINT(MAX+1); - ret.min_overflow := UINT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_UDINT(UINT#0); + ret.negative := UINT_to_UDINT(-1); + ret.positive := UINT_to_UDINT(UINT#22); + ret.max_minus_one := UINT_to_UDINT(MAX-1); + ret.min_plus_one := UINT_to_UDINT(MIN+1); + ret.max_overflow := UINT_to_UDINT(MAX+1); + ret.min_overflow := UINT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2903,27 +2903,27 @@ fn uint_to_udint_conversion() { #[test] fn uint_to_usint_conversion() { let src = r" - TYPE myType : STRUCT - zero : USINT; negative : USINT; positive : USINT; - max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : USINT; negative : USINT; positive : USINT; + max_minus_one : USINT; min_plus_one : USINT; max_overflow : USINT; min_overflow : USINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : UINT := 255; - MIN : UINT := 0; - END_VAR + VAR_GLOBAL + MAX : UINT := 255; + MIN : UINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := UINT_to_USINT(UINT#0); - ret.negative := UINT_to_USINT(-1); - ret.positive := UINT_to_USINT(UINT#22); - ret.max_minus_one := UINT_to_USINT(MAX-1); - ret.min_plus_one := UINT_to_USINT(MIN+1); - ret.max_overflow := UINT_to_USINT(MAX+1); - ret.min_overflow := UINT_to_USINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := UINT_to_USINT(UINT#0); + ret.negative := UINT_to_USINT(-1); + ret.positive := UINT_to_USINT(UINT#22); + ret.max_minus_one := UINT_to_USINT(MAX-1); + ret.min_plus_one := UINT_to_USINT(MIN+1); + ret.max_overflow := UINT_to_USINT(MAX+1); + ret.min_overflow := UINT_to_USINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2941,27 +2941,27 @@ fn uint_to_usint_conversion() { #[test] fn usint_to_lreal_conversion() { let src = r" - TYPE myType : STRUCT - zero : LREAL; negative : LREAL; positive : LREAL; - max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LREAL; negative : LREAL; positive : LREAL; + max_minus_one : LREAL; min_plus_one : LREAL; max_overflow : LREAL; min_overflow : LREAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_LREAL(USINT#0); - ret.negative := USINT_to_LREAL(-2); - ret.positive := USINT_to_LREAL(USINT#22); - ret.max_minus_one := USINT_to_LREAL(MAX-1); - ret.min_plus_one := USINT_to_LREAL(MIN+1); - ret.max_overflow := USINT_to_LREAL(MAX+1); - ret.min_overflow := USINT_to_LREAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_LREAL(USINT#0); + ret.negative := USINT_to_LREAL(-2); + ret.positive := USINT_to_LREAL(USINT#22); + ret.max_minus_one := USINT_to_LREAL(MAX-1); + ret.min_plus_one := USINT_to_LREAL(MIN+1); + ret.max_overflow := USINT_to_LREAL(MAX+1); + ret.min_overflow := USINT_to_LREAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -2979,27 +2979,27 @@ fn usint_to_lreal_conversion() { #[test] fn usint_to_real_conversion() { let src = r" - TYPE myType : STRUCT - zero : REAL; negative : REAL; positive : REAL; - max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : REAL; negative : REAL; positive : REAL; + max_minus_one : REAL; min_plus_one : REAL; max_overflow : REAL; min_overflow : REAL; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_REAL(USINT#0); - ret.negative := USINT_to_REAL(-2); - ret.positive := USINT_to_REAL(USINT#22); - ret.max_minus_one := USINT_to_REAL(MAX-1); - ret.min_plus_one := USINT_to_REAL(MIN+1); - ret.max_overflow := USINT_to_REAL(MAX+1); - ret.min_overflow := USINT_to_REAL(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_REAL(USINT#0); + ret.negative := USINT_to_REAL(-2); + ret.positive := USINT_to_REAL(USINT#22); + ret.max_minus_one := USINT_to_REAL(MAX-1); + ret.min_plus_one := USINT_to_REAL(MIN+1); + ret.max_overflow := USINT_to_REAL(MAX+1); + ret.min_overflow := USINT_to_REAL(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3017,27 +3017,27 @@ fn usint_to_real_conversion() { #[test] fn usint_to_lint_conversion() { let src = r" - TYPE myType : STRUCT - zero : LINT; negative : LINT; positive : LINT; - max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : LINT; negative : LINT; positive : LINT; + max_minus_one : LINT; min_plus_one : LINT; max_overflow : LINT; min_overflow : LINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_LINT(USINT#0); - ret.negative := USINT_to_LINT(-1); - ret.positive := USINT_to_LINT(USINT#22); - ret.max_minus_one := USINT_to_LINT(MAX-1); - ret.min_plus_one := USINT_to_LINT(MIN+1); - ret.max_overflow := USINT_to_LINT(MAX+1); - ret.min_overflow := USINT_to_LINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_LINT(USINT#0); + ret.negative := USINT_to_LINT(-1); + ret.positive := USINT_to_LINT(USINT#22); + ret.max_minus_one := USINT_to_LINT(MAX-1); + ret.min_plus_one := USINT_to_LINT(MIN+1); + ret.max_overflow := USINT_to_LINT(MAX+1); + ret.min_overflow := USINT_to_LINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3055,27 +3055,27 @@ fn usint_to_lint_conversion() { #[test] fn usint_to_dint_conversion() { let src = r" - TYPE myType : STRUCT - zero : DINT; negative : DINT; positive : DINT; - max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : DINT; negative : DINT; positive : DINT; + max_minus_one : DINT; min_plus_one : DINT; max_overflow : DINT; min_overflow : DINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_DINT(USINT#0); - ret.negative := USINT_to_DINT(-1); - ret.positive := USINT_to_DINT(USINT#22); - ret.max_minus_one := USINT_to_DINT(MAX-1); - ret.min_plus_one := USINT_to_DINT(MIN+1); - ret.max_overflow := USINT_to_DINT(MAX+1); - ret.min_overflow := USINT_to_DINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_DINT(USINT#0); + ret.negative := USINT_to_DINT(-1); + ret.positive := USINT_to_DINT(USINT#22); + ret.max_minus_one := USINT_to_DINT(MAX-1); + ret.min_plus_one := USINT_to_DINT(MIN+1); + ret.max_overflow := USINT_to_DINT(MAX+1); + ret.min_overflow := USINT_to_DINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3093,27 +3093,27 @@ fn usint_to_dint_conversion() { #[test] fn usint_to_int_conversion() { let src = r" - TYPE myType : STRUCT - zero : INT; negative : INT; positive : INT; - max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : INT; negative : INT; positive : INT; + max_minus_one : INT; min_plus_one : INT; max_overflow : INT; min_overflow : INT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_INT(USINT#0); - ret.negative := USINT_to_INT(-1); - ret.positive := USINT_to_INT(USINT#22); - ret.max_minus_one := USINT_to_INT(MAX-1); - ret.min_plus_one := USINT_to_INT(MIN+1); - ret.max_overflow := USINT_to_INT(MAX+1); - ret.min_overflow := USINT_to_INT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_INT(USINT#0); + ret.negative := USINT_to_INT(-1); + ret.positive := USINT_to_INT(USINT#22); + ret.max_minus_one := USINT_to_INT(MAX-1); + ret.min_plus_one := USINT_to_INT(MIN+1); + ret.max_overflow := USINT_to_INT(MAX+1); + ret.min_overflow := USINT_to_INT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3131,25 +3131,25 @@ fn usint_to_int_conversion() { #[test] fn usint_to_sint_conversion() { let src = r" - TYPE myType : STRUCT - zero : SINT; negative : SINT; positive : SINT; - max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : SINT; negative : SINT; positive : SINT; + max_minus_one : SINT; min_plus_one : SINT; max_overflow : SINT; min_overflow : SINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 127; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 127; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_SINT(USINT#0); - ret.positive := USINT_to_SINT(USINT#22); - ret.max_minus_one := USINT_to_SINT(MAX-1); - ret.min_plus_one := USINT_to_SINT(MIN+1); - ret.max_overflow := USINT_to_SINT(MAX+1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_SINT(USINT#0); + ret.positive := USINT_to_SINT(USINT#22); + ret.max_minus_one := USINT_to_SINT(MAX-1); + ret.min_plus_one := USINT_to_SINT(MIN+1); + ret.max_overflow := USINT_to_SINT(MAX+1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3165,27 +3165,27 @@ fn usint_to_sint_conversion() { #[test] fn usint_to_ulint_conversion() { let src = r" - TYPE myType : STRUCT - zero : ULINT; negative : ULINT; positive : ULINT; - max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : ULINT; negative : ULINT; positive : ULINT; + max_minus_one : ULINT; min_plus_one : ULINT; max_overflow : ULINT; min_overflow : ULINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_ULINT(USINT#0); - ret.negative := USINT_to_ULINT(-1); - ret.positive := USINT_to_ULINT(USINT#22); - ret.max_minus_one := USINT_to_ULINT(MAX-1); - ret.min_plus_one := USINT_to_ULINT(MIN+1); - ret.max_overflow := USINT_to_ULINT(MAX+1); - ret.min_overflow := USINT_to_ULINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_ULINT(USINT#0); + ret.negative := USINT_to_ULINT(-1); + ret.positive := USINT_to_ULINT(USINT#22); + ret.max_minus_one := USINT_to_ULINT(MAX-1); + ret.min_plus_one := USINT_to_ULINT(MIN+1); + ret.max_overflow := USINT_to_ULINT(MAX+1); + ret.min_overflow := USINT_to_ULINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3203,27 +3203,27 @@ fn usint_to_ulint_conversion() { #[test] fn usint_to_udint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UDINT; negative : UDINT; positive : UDINT; - max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; - END_STRUCT END_TYPE + TYPE myType : STRUCT + zero : UDINT; negative : UDINT; positive : UDINT; + max_minus_one : UDINT; min_plus_one : UDINT; max_overflow : UDINT; min_overflow : UDINT; + END_STRUCT END_TYPE - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_UDINT(USINT#0); - ret.negative := USINT_to_UDINT(-1); - ret.positive := USINT_to_UDINT(USINT#22); - ret.max_minus_one := USINT_to_UDINT(MAX-1); - ret.min_plus_one := USINT_to_UDINT(MIN+1); - ret.max_overflow := USINT_to_UDINT(MAX+1); - ret.min_overflow := USINT_to_UDINT(MIN-1); + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_UDINT(USINT#0); + ret.negative := USINT_to_UDINT(-1); + ret.positive := USINT_to_UDINT(USINT#22); + ret.max_minus_one := USINT_to_UDINT(MAX-1); + ret.min_plus_one := USINT_to_UDINT(MIN+1); + ret.max_overflow := USINT_to_UDINT(MAX+1); + ret.min_overflow := USINT_to_UDINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); @@ -3241,27 +3241,27 @@ fn usint_to_udint_conversion() { #[test] fn usint_to_uint_conversion() { let src = r" - TYPE myType : STRUCT - zero : UINT; negative : UINT; positive : UINT; - max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; - END_STRUCT END_TYPE - - VAR_GLOBAL - MAX : USINT := 255; - MIN : USINT := 0; - END_VAR - - PROGRAM main - VAR - ret : myType; - END_VAR - ret.zero := USINT_to_UINT(USINT#0); - ret.negative := USINT_to_UINT(-1); - ret.positive := USINT_to_UINT(USINT#22); - ret.max_minus_one := USINT_to_UINT(MAX-1); - ret.min_plus_one := USINT_to_UINT(MIN+1); - ret.max_overflow := USINT_to_UINT(MAX+1); - ret.min_overflow := USINT_to_UINT(MIN-1); + TYPE myType : STRUCT + zero : UINT; negative : UINT; positive : UINT; + max_minus_one : UINT; min_plus_one : UINT; max_overflow : UINT; min_overflow : UINT; + END_STRUCT END_TYPE + + VAR_GLOBAL + MAX : USINT := 255; + MIN : USINT := 0; + END_VAR + + PROGRAM main + VAR + ret : myType; + END_VAR + ret.zero := USINT_to_UINT(USINT#0); + ret.negative := USINT_to_UINT(-1); + ret.positive := USINT_to_UINT(USINT#22); + ret.max_minus_one := USINT_to_UINT(MAX-1); + ret.min_plus_one := USINT_to_UINT(MIN+1); + ret.max_overflow := USINT_to_UINT(MAX+1); + ret.min_overflow := USINT_to_UINT(MIN-1); END_PROGRAM "; let sources = add_std!(src, "num_conversion.st", "numerical_functions.st"); diff --git a/libs/stdlib/tests/string_conversion_tests.rs b/libs/stdlib/tests/string_conversion_tests.rs index 6217d28fec..696e19caf8 100644 --- a/libs/stdlib/tests/string_conversion_tests.rs +++ b/libs/stdlib/tests/string_conversion_tests.rs @@ -13,12 +13,12 @@ fn wstring_to_string_conversion() { } let src = r#" - PROGRAM main - VAR - res : STRING; - ptr : REF_TO STRING; - END_VAR - res := WSTRING_TO_STRING(WSTRING#"hello"); + PROGRAM main + VAR + res : STRING; + ptr : REF_TO STRING; + END_VAR + res := WSTRING_TO_STRING(WSTRING#"hello"); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -35,12 +35,12 @@ fn empty_wstring_to_string_conversion() { } let src = r#" - PROGRAM main - VAR - res : STRING; - ptr : REF_TO STRING; - END_VAR - res := WSTRING_TO_STRING(""); + PROGRAM main + VAR + res : STRING; + ptr : REF_TO STRING; + END_VAR + res := WSTRING_TO_STRING(""); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -57,12 +57,12 @@ fn wstring_to_string_extra_conversion() { } let src = r#" - PROGRAM main - VAR - res : STRING; - ptr : REF_TO STRING; - END_VAR - res := WSTRING_TO_STRING(WSTRING#"hèßlo👽️"); + PROGRAM main + VAR + res : STRING; + ptr : REF_TO STRING; + END_VAR + res := WSTRING_TO_STRING(WSTRING#"hèßlo👽️"); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -80,12 +80,12 @@ fn wstring_to_string_conversion_long() { } let src = r#" - PROGRAM main - VAR - res : STRING; - ptr : REF_TO STRING; - END_VAR - res := WSTRING_TO_STRING("111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999"); + PROGRAM main + VAR + res : STRING; + ptr : REF_TO STRING; + END_VAR + res := WSTRING_TO_STRING("111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999"); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -109,11 +109,11 @@ fn wstring_to_wchar_conversion() { } let src = r#" - PROGRAM main - VAR - res : WCHAR; - END_VAR - res := WSTRING_TO_WCHAR(WSTRING#"ABC"); + PROGRAM main + VAR + res : WCHAR; + END_VAR + res := WSTRING_TO_WCHAR(WSTRING#"ABC"); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -130,11 +130,11 @@ fn string_to_wstring_conversion() { } let src = r#" - PROGRAM main - VAR - res : WSTRING; - END_VAR - res := STRING_TO_WSTRING(STRING#'Hello'); + PROGRAM main + VAR + res : WSTRING; + END_VAR + res := STRING_TO_WSTRING(STRING#'Hello'); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -151,11 +151,11 @@ fn empty_string_to_wstring_conversion() { } let src = r#" - PROGRAM main - VAR - res : WSTRING; - END_VAR - res := STRING_TO_WSTRING(''); + PROGRAM main + VAR + res : WSTRING; + END_VAR + res := STRING_TO_WSTRING(''); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -170,11 +170,11 @@ fn string_to_wstring_extra_conversion() { res: [u16; 8], } let src = r#" - PROGRAM main - VAR - res : WSTRING; - END_VAR - res := STRING_TO_WSTRING('Hèßlo😀'); + PROGRAM main + VAR + res : WSTRING; + END_VAR + res := STRING_TO_WSTRING('Hèßlo😀'); END_PROGRAM "#; @@ -195,11 +195,11 @@ fn string_to_wstring_long_conversion() { res: [u16; 81], } let src = r#" - PROGRAM main - VAR - res : WSTRING; - END_VAR - res := STRING_TO_WSTRING('111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999'); + PROGRAM main + VAR + res : WSTRING; + END_VAR + res := STRING_TO_WSTRING('111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999'); END_PROGRAM "#; @@ -228,11 +228,11 @@ fn string_to_char_conversion() { } let src = r#" - PROGRAM main - VAR - res : CHAR; - END_VAR - res := STRING_TO_CHAR(STRING#'BCD'); + PROGRAM main + VAR + res : CHAR; + END_VAR + res := STRING_TO_CHAR(STRING#'BCD'); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -249,11 +249,11 @@ fn wchar_to_wstring_conversion() { } let src = r#" - PROGRAM main - VAR - res : WSTRING[1]; - END_VAR - res := WCHAR_TO_WSTRING(WCHAR#"A"); + PROGRAM main + VAR + res : WSTRING[1]; + END_VAR + res := WCHAR_TO_WSTRING(WCHAR#"A"); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -270,11 +270,11 @@ fn wchar_to_char_conversion() { } let src = r#" - PROGRAM main - VAR - res : CHAR; - END_VAR - res := WCHAR_TO_CHAR(WCHAR#"A"); + PROGRAM main + VAR + res : CHAR; + END_VAR + res := WCHAR_TO_CHAR(WCHAR#"A"); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -291,11 +291,11 @@ fn char_to_string_conversion() { } let src = r#" - PROGRAM main - VAR - res : STRING[1]; - END_VAR - res := CHAR_TO_STRING(CHAR#'B'); + PROGRAM main + VAR + res : STRING[1]; + END_VAR + res := CHAR_TO_STRING(CHAR#'B'); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); @@ -312,11 +312,11 @@ fn char_to_wchar_conversion() { } let src = r#" - PROGRAM main - VAR - res : WCHAR; - END_VAR - res := CHAR_TO_WCHAR(CHAR#'B'); + PROGRAM main + VAR + res : WCHAR; + END_VAR + res := CHAR_TO_WCHAR(CHAR#'B'); END_PROGRAM "#; let sources = add_std!(src, "string_conversion.st", "string_functions.st"); diff --git a/libs/stdlib/tests/string_function_tests.rs b/libs/stdlib/tests/string_function_tests.rs index e2c576b54b..1ca3159086 100644 --- a/libs/stdlib/tests/string_function_tests.rs +++ b/libs/stdlib/tests/string_function_tests.rs @@ -23,12 +23,12 @@ fn string_from_utf16(src: &[u16]) -> Result { #[test] fn len_string() { let src = r#" - FUNCTION main : DINT + FUNCTION main : DINT VAR variable: STRING; END_VAR variable := ' this is a very long sentence with plenty of characters.'; - main := LEN(variable); + main := LEN(variable); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -39,8 +39,8 @@ fn len_string() { #[test] fn len_string_long_string() { let src = r#" - FUNCTION main : DINT - main := LEN(' this is a very long sentence with plenty of characters and weird spacing.'); + FUNCTION main : DINT + main := LEN(' this is a very long sentence with plenty of characters and weird spacing.'); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -51,8 +51,8 @@ fn len_string_long_string() { #[test] fn len_string_no_variable() { let src = r#" - FUNCTION main : DINT - main := LEN(STRING#'hello'); + FUNCTION main : DINT + main := LEN(STRING#'hello'); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -63,12 +63,12 @@ fn len_string_no_variable() { #[test] fn len_string_empty() { let src = r#" - FUNCTION main : DINT + FUNCTION main : DINT VAR_TEMP in : STRING[1024]; END_VAR in := ''; - main := LEN(in); + main := LEN(in); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -79,12 +79,12 @@ fn len_string_empty() { #[test] fn left_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; END_VAR in := 'hello'; - main := LEFT(in, DINT#3); + main := LEFT(in, DINT#3); END_FUNCTION "#; @@ -101,12 +101,12 @@ fn left_string() { #[test] fn left_string_long_string() { let src = r#" - FUNCTION main : STRING[2048] + FUNCTION main : STRING[2048] VAR_TEMP in : STRING[100]; END_VAR in := ' this is a very long sentence with plenty of characters and weird spacing.'; - main := LEFT(in, DINT#85); + main := LEFT(in, DINT#85); END_FUNCTION "#; @@ -126,14 +126,14 @@ fn left_string_long_string() { #[test] fn left_string_lint() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; l : LINT; END_VAR in := 'lets see if long int is handled correctly'; l := 31; - main := LEFT(in, l); + main := LEFT(in, l); END_FUNCTION "#; @@ -150,7 +150,7 @@ fn left_string_lint() { #[test] fn left_ext_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; out : STRING; @@ -159,7 +159,7 @@ fn left_ext_string() { in := 'extended'; l := 6; LEFT_EXT(in, l, out); - main := out; + main := out; END_FUNCTION "#; @@ -176,12 +176,12 @@ fn left_ext_string() { #[test] fn right_string_usint() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; END_VAR in := 'sample text'; - main := RIGHT(in, USINT#7); + main := RIGHT(in, USINT#7); END_FUNCTION "#; @@ -201,12 +201,12 @@ fn right_string_usint() { #[should_panic(expected = "Requested substring length exceeds string length.")] fn right_string_substring_too_long() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; END_VAR in := 'sample text'; - main := RIGHT(in, 12); + main := RIGHT(in, 12); END_FUNCTION "#; @@ -217,14 +217,14 @@ fn right_string_substring_too_long() { #[test] fn right_ext_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; out : STRING; END_VAR in := 'extended'; RIGHT_EXT(in, 3, out); - main := out; + main := out; END_FUNCTION "#; @@ -241,7 +241,7 @@ fn right_ext_string() { #[test] fn right_string_long_string() { let src = r#" - FUNCTION main : STRING[2048] + FUNCTION main : STRING[2048] VAR_TEMP in : STRING[100]; l : DINT; @@ -268,16 +268,16 @@ fn right_string_long_string() { #[test] fn right_ext_string_long_string() { let src = r#" - FUNCTION main : STRING[2048] + FUNCTION main : STRING[2048] VAR_TEMP in : STRING[128]; out : STRING[128]; l : DINT; - END_VAR + END_VAR in := '7gAN5pmmSXqHJ3zZCXnBwika9N8RPXpTAdX4LdwHbLjwv9g3mU3dtpCT2MHVPxwtMw6jMQkip3HDy8Ruw42pVi56fiVhYn8faPLUKRghytQcBFgZhMXGhpBW'; l := 99; RIGHT_EXT(in, l, out); - main := out; + main := out; END_FUNCTION "#; @@ -297,7 +297,7 @@ fn right_ext_string_long_string() { #[test] fn mid_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; l : DINT; @@ -306,7 +306,7 @@ fn mid_string() { in := 'sample text'; l := 7; p := 2; - main := MID(in, l, p); + main := MID(in, l, p); END_FUNCTION "#; @@ -323,16 +323,16 @@ fn mid_string() { #[test] fn mid_string_long_literal() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP l : DINT; p : DINT; END_VAR l := 4; p := 6; - main := MID( + main := MID( ' this is a very long sentence with plenty of characters and weird spacing.the same is true for this string.', - l, + l, p ); END_FUNCTION @@ -351,7 +351,7 @@ fn mid_string_long_literal() { #[test] fn mid_ext_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; out : STRING; @@ -362,7 +362,7 @@ fn mid_ext_string() { l := 7; p := 2; MID_EXT(in, l, p, out); - main := out; + main := out; END_FUNCTION "#; @@ -379,7 +379,7 @@ fn mid_ext_string() { #[test] fn mid_string_long_string() { let src = r#" - FUNCTION main : STRING[2048] + FUNCTION main : STRING[2048] VAR_TEMP in : STRING[128]; l : DINT; @@ -388,7 +388,7 @@ fn mid_string_long_string() { in := '7gAN5pmmSXqHJ3zZCXnBwika9N8RPXpTAdX4LdwHbLjwv9g3mU3dtpCT2MHVPxwtMw6jMQkip3HDy8Ruw42pVi56fiVhYn8faPLUKRghytQcBFgZhMXGhpBW'; l := 99; p := 10; - main := MID(in, l, p); + main := MID(in, l, p); END_FUNCTION "#; @@ -408,13 +408,13 @@ fn mid_string_long_string() { #[test] fn mid_ext_string_long_string() { let src = r#" - FUNCTION main : STRING[2048] + FUNCTION main : STRING[2048] VAR_TEMP in : STRING[128]; out : STRING[128]; l : DINT; p : DINT; - END_VAR + END_VAR in := '7gAN5pmmSXqHJ3zZCXnBwika9N8RPXpTAdX4LdwHbLjwv9g3mU3dtpCT2MHVPxwtMw6jMQkip3HDy8Ruw42pVi56fiVhYn8faPLUKRghytQcBFgZhMXGhpBW'; l := 99; p := 10; @@ -438,7 +438,7 @@ fn mid_ext_string_long_string() { #[test] fn insert_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in1 : STRING; in2 : STRING; @@ -447,7 +447,7 @@ fn insert_string() { in1 := 'stuck with you'; in2 := 'in the middle '; p := 6; - main := INSERT(in1, in2, p); + main := INSERT(in1, in2, p); END_FUNCTION "#; @@ -464,7 +464,7 @@ fn insert_string() { #[test] fn insert_ext_string_at_start_and_end() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in1 : STRING; in2 : STRING; @@ -472,10 +472,10 @@ fn insert_ext_string_at_start_and_end() { END_VAR in1 := '2'; in2 := '1'; - INSERT_EXT(in1, in2, 0, out); + INSERT_EXT(in1, in2, 0, out); in1 := out; in2 := '3'; - INSERT_EXT(in1, in2, 2, out); + INSERT_EXT(in1, in2, 2, out); main := out; END_FUNCTION "#; @@ -493,7 +493,7 @@ fn insert_ext_string_at_start_and_end() { #[test] fn delete_string_with_escape_sequence() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; l : UINT; @@ -502,7 +502,7 @@ fn delete_string_with_escape_sequence() { in := 'the$$e are escape sequences $'𝄞$''; l := 21; p := 6; - main := DELETE(in, l, p); + main := DELETE(in, l, p); END_FUNCTION "#; @@ -516,7 +516,7 @@ fn delete_string_with_escape_sequence() { #[test] fn delete_ext_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; out : STRING; @@ -526,7 +526,7 @@ fn delete_ext_string() { in := '𝄞typoasdf'; l := 4; p := 6; - DELETE_EXT(in, l, p, out); + DELETE_EXT(in, l, p, out); main := out; END_FUNCTION "#; @@ -544,7 +544,7 @@ fn delete_ext_string() { #[test] fn delete_ext_string_with_escape_sequence() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in : STRING; out : STRING; @@ -554,7 +554,7 @@ fn delete_ext_string_with_escape_sequence() { in := 'the$$e are escape sequences $'𝄞$''; l := 21; p := 6; - DELETE_EXT(in, l, p, out); + DELETE_EXT(in, l, p, out); main := out; END_FUNCTION "#; @@ -569,7 +569,7 @@ fn delete_ext_string_with_escape_sequence() { #[test] fn replace_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in1 : STRING; in2 : STRING; @@ -580,7 +580,7 @@ fn replace_string() { in2 := 'gret𝄞'; l := 8; p := 3; - main := REPLACE(in1, in2, l, p); + main := REPLACE(in1, in2, l, p); END_FUNCTION "#; @@ -597,7 +597,7 @@ fn replace_string() { #[test] fn replace_ext_string() { let src = r#" - FUNCTION main : STRING + FUNCTION main : STRING VAR_TEMP in1 : STRING; in2 : STRING; @@ -609,7 +609,7 @@ fn replace_ext_string() { in2 := 'st𝄞red'; l := 8; p := 3; - REPLACE_EXT(in1, in2, l, p, out); + REPLACE_EXT(in1, in2, l, p, out); main := out; END_FUNCTION "#; @@ -634,7 +634,7 @@ fn find_string() { END_VAR in1 := 'Where is Waldo?'; in2 := 'Waldo'; - main := FIND(in1, in2); + main := FIND(in1, in2); END_FUNCTION "#; @@ -654,7 +654,7 @@ fn test_double_quotes_on_strings() { END_VAR in1 := "Where is Waldo?"; in2 := "Waldo"; - main := FIND(in1, in2); + main := FIND(in1, in2); END_FUNCTION "#; @@ -671,7 +671,7 @@ fn test_concat_string() { b : STRING := ', '; c : STRING := 'World'; d : STRING := '!'; - END_VAR + END_VAR main := CONCAT(a, b, c, d); END_FUNCTION "#; @@ -696,7 +696,7 @@ fn test_concat_ext_string() { b : STRING := ', '; c : STRING := 'World'; d : STRING := '!'; - END_VAR + END_VAR CONCAT_EXT(main, a, b, c, d); END_FUNCTION "#; @@ -766,12 +766,12 @@ the same is true for t #[test] fn len_wstring() { let src = r#" - FUNCTION main : DINT + FUNCTION main : DINT VAR_TEMP in : WSTRING; END_VAR in := "Hèßlo😀𝄞"; - main := LEN(in); + main := LEN(in); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -782,8 +782,8 @@ fn len_wstring() { #[test] fn len_wstring_no_variable() { let src = r#" - FUNCTION main : DINT - main := LEN(WSTRING#'Hèßlo😀𝄞'); + FUNCTION main : DINT + main := LEN(WSTRING#'Hèßlo😀𝄞'); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -794,12 +794,12 @@ fn len_wstring_no_variable() { #[test] fn len_wstring_empty() { let src = r#" - FUNCTION main : DINT + FUNCTION main : DINT VAR_TEMP in : WSTRING[1024]; END_VAR in := ""; - main := LEN(in); + main := LEN(in); END_FUNCTION "#; let sources = add_std!(src, "string_functions.st"); @@ -810,12 +810,12 @@ fn len_wstring_empty() { #[test] fn left_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; END_VAR in := "𝄞music"; - main := LEFT(in, DINT#2); + main := LEFT(in, DINT#2); END_FUNCTION "#; @@ -832,14 +832,14 @@ fn left_wstring() { #[test] fn left_wstring_lint() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; l : LINT; END_VAR in := "lets see 𝄞f long 𝄞nt is handled correctly"; l := 31; - main := LEFT(in, l); + main := LEFT(in, l); END_FUNCTION "#; @@ -856,7 +856,7 @@ fn left_wstring_lint() { #[test] fn left_ext_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; out : WSTRING; @@ -865,7 +865,7 @@ fn left_ext_wstring() { in := "e𝄞tended"; l := 6; LEFT_EXT(in, l, out); - main := out; + main := out; END_FUNCTION "#; @@ -882,12 +882,12 @@ fn left_ext_wstring() { #[test] fn right_wstring_usint() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; END_VAR in := "samp𝄞e text"; - main := RIGHT(in, USINT#7); + main := RIGHT(in, USINT#7); END_FUNCTION "#; @@ -907,12 +907,12 @@ fn right_wstring_usint() { #[should_panic(expected = "Requested substring length exceeds string length.")] fn right_wstring_substring_too_long() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; END_VAR in := "sa𝄞ple text"; - main := RIGHT(in, 12); + main := RIGHT(in, 12); END_FUNCTION "#; @@ -923,14 +923,14 @@ fn right_wstring_substring_too_long() { #[test] fn right_ext_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; out : WSTRING; END_VAR in := "exten𝄞ed𝄞"; RIGHT_EXT(in, 4, out); - main := out; + main := out; END_FUNCTION "#; @@ -947,7 +947,7 @@ fn right_ext_wstring() { #[test] fn right_string_long_wstring() { let src = r#" - FUNCTION main : WSTRING[128] + FUNCTION main : WSTRING[128] VAR_TEMP in : WSTRING[128]; l : DINT; @@ -971,12 +971,12 @@ fn right_string_long_wstring() { #[test] fn right_ext_string_long_wstring() { let src = r#" - FUNCTION main : WSTRING[128] + FUNCTION main : WSTRING[128] VAR_TEMP in : WSTRING[128]; out : WSTRING[128]; l : DINT; - END_VAR + END_VAR in := "7gAN5pmmSXqHJ3zZCXnBwi𝄞𝄞9N8RPXpTAdX4LdwHbLjwv9g3mU3dtpCT2MHVPxwtMw6jMQkip3HDy8Ruw42pVi56fiVhYn8faPLUKRghytQcBFgZhMXGhpBW"; l := 99; RIGHT_EXT(in, l, main); @@ -996,7 +996,7 @@ fn right_ext_string_long_wstring() { #[test] fn mid_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; l : DINT; @@ -1005,7 +1005,7 @@ fn mid_wstring() { in := "sample 𝄞muϗ😀 text"; l := 7; p := 2; - main := MID(in, l, p); + main := MID(in, l, p); END_FUNCTION "#; @@ -1022,7 +1022,7 @@ fn mid_wstring() { #[test] fn mid_ext_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; out : WSTRING; @@ -1033,7 +1033,7 @@ fn mid_ext_wstring() { l := 7; p := 2; MID_EXT(in, l, p, out); - main := out; + main := out; END_FUNCTION "#; @@ -1050,7 +1050,7 @@ fn mid_ext_wstring() { #[test] fn mid_string_long_wstring() { let src = r#" - FUNCTION main : WSTRING[128] + FUNCTION main : WSTRING[128] VAR_TEMP in : WSTRING[128]; l : DINT; @@ -1059,7 +1059,7 @@ fn mid_string_long_wstring() { in := "𝄞muϗ😀pmmSXqHJ3zZCXnBwika9N8RPXpTAdX4LdwHbLjwv9g3mU3dtpCT2MHVPxwtMw6jMQkip3HDy8Ruw42pVi56fiVhYn8faPLUKRghytQcBFgZhMXGhpBW"; l := 99; p := 10; - main := MID(in, l, p); + main := MID(in, l, p); END_FUNCTION "#; @@ -1076,12 +1076,12 @@ fn mid_string_long_wstring() { #[test] fn mid_ext_string_long_wstring() { let src = r#" - FUNCTION main : WSTRING[128] + FUNCTION main : WSTRING[128] VAR_TEMP in : WSTRING[128]; l : DINT; p : DINT; - END_VAR + END_VAR in := "𝄞muϗ😀pmmSXqHJ3zZCXnBwika9N8RPXpTAdX4LdwHbLjwv9g3mU3dtpCT2MHVPxwtMw6jMQkip3HDy8Ruw42pVi56fiVhYn8faPLUKRghytQcBFgZhMXGhpBW"; l := 99; p := 10; @@ -1102,7 +1102,7 @@ fn mid_ext_string_long_wstring() { #[test] fn insert_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in1 : WSTRING; in2 : WSTRING; @@ -1111,7 +1111,7 @@ fn insert_wstring() { in1 := "stuck with you"; in2 := "in the middle "; p := 6; - main := INSERT(in1, in2, p); + main := INSERT(in1, in2, p); END_FUNCTION "#; @@ -1122,7 +1122,7 @@ fn insert_wstring() { assert_eq!(res, "stuck in the middle with you"); } else { panic!( - "Given string is not + "Given string is not -encoded" ) } @@ -1131,7 +1131,7 @@ fn insert_wstring() { #[test] fn insert_ext_wstring_at_start_and_end() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in1 : WSTRING; in2 : WSTRING; @@ -1139,10 +1139,10 @@ fn insert_ext_wstring_at_start_and_end() { END_VAR in1 := "2"; in2 := "1"; - INSERT_EXT(in1, in2, 0, out); + INSERT_EXT(in1, in2, 0, out); in1 := out; in2 := "3"; - INSERT_EXT(in1, in2, 2, out); + INSERT_EXT(in1, in2, 2, out); main := out; END_FUNCTION "#; @@ -1160,7 +1160,7 @@ fn insert_ext_wstring_at_start_and_end() { #[test] fn delete_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; l : UINT; @@ -1169,7 +1169,7 @@ fn delete_wstring() { in := "this will be deleted"; l := 13; p := 1; - main := DELETE(in, l, p); + main := DELETE(in, l, p); END_FUNCTION "#; @@ -1186,7 +1186,7 @@ fn delete_wstring() { #[test] fn delete_ext_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; out : WSTRING; @@ -1196,7 +1196,7 @@ fn delete_ext_wstring() { in := "typoasdf"; l := 4; p := 5; - DELETE_EXT(in, l, p, out); + DELETE_EXT(in, l, p, out); main := out; END_FUNCTION "#; @@ -1215,7 +1215,7 @@ fn delete_ext_wstring() { #[test] fn replace_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in1 : WSTRING; in2 : WSTRING; @@ -1226,7 +1226,7 @@ fn replace_wstring() { in2 := "gret"; l := 8; p := 3; - main := REPLACE(in1, in2, l, p); + main := REPLACE(in1, in2, l, p); END_FUNCTION "#; @@ -1243,7 +1243,7 @@ fn replace_wstring() { #[test] fn replace_ext_wstring() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in1 : WSTRING; in2 : WSTRING; @@ -1255,7 +1255,7 @@ fn replace_ext_wstring() { in2 := "stored"; l := 8; p := 3; - REPLACE_EXT(in1, in2, l, p, out); + REPLACE_EXT(in1, in2, l, p, out); main := out; END_FUNCTION "#; @@ -1280,7 +1280,7 @@ fn find_wstring() { END_VAR in1 := "Where is Waldo?"; in2 := "Waldo"; - main := FIND(in1, in2); + main := FIND(in1, in2); END_FUNCTION "#; @@ -1292,7 +1292,7 @@ fn find_wstring() { #[test] fn delete_wstring_with_escape_sequence() { let src = r#" - FUNCTION main : WSTRING + FUNCTION main : WSTRING VAR_TEMP in : WSTRING; l : UINT; @@ -1301,7 +1301,7 @@ fn delete_wstring_with_escape_sequence() { in := "the$$e are escape sequences $"𝄞$""; l := 21; p := 6; - main := DELETE(in, l, p); + main := DELETE(in, l, p); END_FUNCTION "#; @@ -1324,7 +1324,7 @@ fn test_concat_wstring() { b : WSTRING := ", "; c : WSTRING := "World"; d : WSTRING := "!"; - END_VAR + END_VAR main := CONCAT(a, b, c, d); END_FUNCTION "#; @@ -1348,7 +1348,7 @@ fn test_concat_ext_wstring() { b : WSTRING := ", "; c : WSTRING := "World"; d : WSTRING := "!"; - END_VAR + END_VAR CONCAT_EXT(main, a, b, c, d); END_FUNCTION "#; @@ -1372,7 +1372,7 @@ fn test_gt_string() { a : STRING := 'z'; b : STRING := 'y '; c : STRING := 'x'; - END_VAR + END_VAR main := GT(a, b, c); END_FUNCTION "#; @@ -1391,7 +1391,7 @@ fn test_ge_string() { b : STRING := 'z'; c : STRING := 'y'; d : STRING := 'x'; - END_VAR + END_VAR main := GE(a, b, c, d); END_FUNCTION "#; @@ -1409,7 +1409,7 @@ fn test_eq_string() { a : STRING := 'same'; b : STRING := 'same'; c : STRING := 'same'; - END_VAR + END_VAR main := EQ(a, b, c); END_FUNCTION "#; @@ -1428,7 +1428,7 @@ fn test_lt_string() { b : STRING := 'z'; c : STRING := 'y'; d : STRING := 'x'; - END_VAR + END_VAR main := LT(d, c, b, a); END_FUNCTION "#; @@ -1447,7 +1447,7 @@ fn test_le_string() { b : STRING := 'z'; c : STRING := 'y'; d : STRING := 'x'; - END_VAR + END_VAR main := LE(d, c, b, a); END_FUNCTION "#; @@ -1464,7 +1464,7 @@ fn test_ne_string() { VAR_TEMP a : STRING := 'z'; b : STRING := 'y'; - END_VAR + END_VAR main := NE(a, b); END_FUNCTION "#; @@ -1482,7 +1482,7 @@ fn test_gt_wstring() { a : WSTRING := "z"; b : WSTRING := "y"; c : WSTRING := "x"; - END_VAR + END_VAR main := GT(a, b, c); END_FUNCTION "#; @@ -1501,7 +1501,7 @@ fn test_ge_wstring() { b : WSTRING := "z"; c : WSTRING := "y"; d : WSTRING := "x"; - END_VAR + END_VAR main := GE(a, b, c, d); END_FUNCTION "#; @@ -1519,7 +1519,7 @@ fn test_eq_wstring() { a : WSTRING := "same"; b : WSTRING := "same"; c : WSTRING := "same"; - END_VAR + END_VAR main := EQ(a, b, c); END_FUNCTION "#; @@ -1538,7 +1538,7 @@ fn test_lt_wstring() { b : WSTRING := "z"; c : WSTRING := "y"; d : WSTRING := "x"; - END_VAR + END_VAR main := LT(d, c, b, a); END_FUNCTION "#; @@ -1557,7 +1557,7 @@ fn test_le_wstring() { b : WSTRING := "z"; c : WSTRING := "y"; d : WSTRING := "x"; - END_VAR + END_VAR main := LE(d, c, b, a); END_FUNCTION "#; @@ -1589,7 +1589,7 @@ fn test_string_greater_operator_works_if_result_is_true() { VAR_TEMP a : STRING := 'zyx'; b : STRING := 'yx'; - END_VAR + END_VAR main := a > b; END_FUNCTION "#; @@ -1621,7 +1621,7 @@ fn test_string_binary_operator_wrapper_functions_work_if_expressions_evaluate_to b : STRING := 'abc'; c : STRING := 'bcd'; d : STRING := 'cba'; - END_VAR + END_VAR lt := a < c AND b < c AND c < d; le := a <= b AND a <= c; eq := a = b; @@ -1650,7 +1650,7 @@ fn test_wstring_binary_operator_wrapper_functions_work() { b : WSTRING := "abc"; c : WSTRING := "bcd"; d : WSTRING := "cba"; - END_VAR + END_VAR lt := a < c AND b < c AND c < d; le := a <= b AND a <= c; eq := a = b; @@ -1679,7 +1679,7 @@ fn test_string_binary_operator_wrapper_functions_work_if_expressions_evaluate_to b : STRING := 'abc'; c : STRING := 'bcd'; d : STRING := 'cba'; - END_VAR + END_VAR lt := c < a OR c < b OR d < c; le := c <= a OR d <= c; eq := a = d OR a = c OR c = d; @@ -1703,7 +1703,7 @@ fn test_string_equality_operator_works_for_long_strings() { VAR_TEMP a : STRING := 'this very long unimaginative sentence consists of the same characters in the same sequence twice'; b : STRING := 'this very long unimaginative sentence consists of the same characters in the same sequence twice'; - END_VAR + END_VAR main := a = b; END_FUNCTION "#; @@ -1720,7 +1720,7 @@ fn test_string_not_equal_operator_works_for_long_strings() { VAR_TEMP a : STRING := 'this very long unimaginative sentence consists of the same characters in the same sequence twice'; b : STRING := 'this very long unimaginative sentence claims the previous string is dishonest'; - END_VAR + END_VAR main := a <> b; END_FUNCTION "#; diff --git a/libs/stdlib/tests/validation_functions_tests.rs b/libs/stdlib/tests/validation_functions_tests.rs index bd489ec36d..a7e58d92a0 100644 --- a/libs/stdlib/tests/validation_functions_tests.rs +++ b/libs/stdlib/tests/validation_functions_tests.rs @@ -17,27 +17,27 @@ struct MainType { #[test] fn is_valid_real() { let src = " - VAR_GLOBAL - MAX : REAL := 3.4028235e38; - MIN : REAL := -3.4028235e38; - INF : REAL := 1.0 / 0.0; - NaN : REAL := 0.0 / 0.0; - END_VAR - - PROGRAM main - VAR - max_ : BOOL; - min_ : BOOL; - zero : BOOL; - inf_ : BOOL; - nan_ : BOOL; - END_VAR - max_ := IS_VALID(MAX); - min_ := IS_VALID(MIN); - zero := IS_VALID(REAL#0.0); - inf_ := IS_VALID(INF); - nan_ := IS_VALID(NaN); - END_PROGRAM"; + VAR_GLOBAL + MAX : REAL := 3.4028235e38; + MIN : REAL := -3.4028235e38; + INF : REAL := 1.0 / 0.0; + NaN : REAL := 0.0 / 0.0; + END_VAR + + PROGRAM main + VAR + max_ : BOOL; + min_ : BOOL; + zero : BOOL; + inf_ : BOOL; + nan_ : BOOL; + END_VAR + max_ := IS_VALID(MAX); + min_ := IS_VALID(MIN); + zero := IS_VALID(REAL#0.0); + inf_ := IS_VALID(INF); + nan_ := IS_VALID(NaN); + END_PROGRAM"; let sources = add_std!(src, "validation_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -56,27 +56,27 @@ fn is_valid_real() { #[test] fn is_valid_lreal() { let src = " - VAR_GLOBAL - MAX : LREAL := 1.7976931348623157e308; - MIN : LREAL := LREAL#-1.7976931348623157e308; - INF : LREAL := 1.0 / 0.0; - NaN : LREAL := 0.0 / 0.0; - END_VAR - - PROGRAM main - VAR - max_ : BOOL; - min_ : BOOL; - zero : BOOL; - inf_ : BOOL; - nan_ : BOOL; - END_VAR - max_ := IS_VALID(MAX); - min_ := IS_VALID(MIN); - zero := IS_VALID(LREAL#0.0); - inf_ := IS_VALID(INF); - nan_ := IS_VALID(NaN); - END_PROGRAM"; + VAR_GLOBAL + MAX : LREAL := 1.7976931348623157e308; + MIN : LREAL := LREAL#-1.7976931348623157e308; + INF : LREAL := 1.0 / 0.0; + NaN : LREAL := 0.0 / 0.0; + END_VAR + + PROGRAM main + VAR + max_ : BOOL; + min_ : BOOL; + zero : BOOL; + inf_ : BOOL; + nan_ : BOOL; + END_VAR + max_ := IS_VALID(MAX); + min_ := IS_VALID(MIN); + zero := IS_VALID(LREAL#0.0); + inf_ := IS_VALID(INF); + nan_ := IS_VALID(NaN); + END_PROGRAM"; let sources = add_std!(src, "validation_functions.st"); let mut maintype = MainType::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -109,21 +109,21 @@ struct StructBCD { #[test] fn is_valid_byte() { let src = " - PROGRAM main - VAR - valid : BOOL; - invalid : BOOL; - END_VAR - VAR_TEMP - v_valid : BYTE; - v_invalid : BYTE; - END_VAR - v_valid := 2#0011_0010; // in BCD 3_2 => VALID - valid := IS_VALID_BCD(v_valid); - - v_invalid := 2#0010_1100; // in BCD 2_[12] => INVALID - invalid := IS_VALID_BCD(v_invalid); - END_PROGRAM"; + PROGRAM main + VAR + valid : BOOL; + invalid : BOOL; + END_VAR + VAR_TEMP + v_valid : BYTE; + v_invalid : BYTE; + END_VAR + v_valid := 2#0011_0010; // in BCD 3_2 => VALID + valid := IS_VALID_BCD(v_valid); + + v_invalid := 2#0010_1100; // in BCD 2_[12] => INVALID + invalid := IS_VALID_BCD(v_invalid); + END_PROGRAM"; let sources = add_std!(src, "validation_functions.st"); let mut maintype = StructBCD::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -134,21 +134,21 @@ fn is_valid_byte() { #[test] fn is_valid_word() { let src = " - PROGRAM main - VAR - valid : BOOL; - invalid : BOOL; - END_VAR - VAR_TEMP - v_valid : WORD; - v_invalid : WORD; - END_VAR - v_valid := 2#0100_1000_0111_0001; // in BCD 4_8_7_1 => VALID - valid := IS_VALID_BCD(v_valid); - - v_invalid := 2#0100_1011_0111_0001; // in BCD 4_[11]_7_1 => INVALID - invalid := IS_VALID_BCD(v_invalid); - END_PROGRAM"; + PROGRAM main + VAR + valid : BOOL; + invalid : BOOL; + END_VAR + VAR_TEMP + v_valid : WORD; + v_invalid : WORD; + END_VAR + v_valid := 2#0100_1000_0111_0001; // in BCD 4_8_7_1 => VALID + valid := IS_VALID_BCD(v_valid); + + v_invalid := 2#0100_1011_0111_0001; // in BCD 4_[11]_7_1 => INVALID + invalid := IS_VALID_BCD(v_invalid); + END_PROGRAM"; let sources = add_std!(src, "validation_functions.st"); let mut maintype = StructBCD::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -159,21 +159,21 @@ fn is_valid_word() { #[test] fn is_valid_dword() { let src = " - PROGRAM main - VAR - valid : BOOL; - invalid : BOOL; - END_VAR - VAR_TEMP - v_valid : DWORD; - v_invalid : DWORD; - END_VAR - v_valid := 2#0100_1000_0111_0001_0100_1000_0111_0001; // in BCD 4_8_7_1_4_8_7_1 => VALID - valid := IS_VALID_BCD(v_valid); - - v_invalid := 2#0100_1011_0111_0001_0100_1011_0111_0001; // in BCD 4_[11]_7_1_4_11_7_1 => INVALID - invalid := IS_VALID_BCD(v_invalid); - END_PROGRAM"; + PROGRAM main + VAR + valid : BOOL; + invalid : BOOL; + END_VAR + VAR_TEMP + v_valid : DWORD; + v_invalid : DWORD; + END_VAR + v_valid := 2#0100_1000_0111_0001_0100_1000_0111_0001; // in BCD 4_8_7_1_4_8_7_1 => VALID + valid := IS_VALID_BCD(v_valid); + + v_invalid := 2#0100_1011_0111_0001_0100_1011_0111_0001; // in BCD 4_[11]_7_1_4_11_7_1 => INVALID + invalid := IS_VALID_BCD(v_invalid); + END_PROGRAM"; let sources = add_std!(src, "validation_functions.st"); let mut maintype = StructBCD::default(); let _: i64 = compile_and_run(sources, &mut maintype); @@ -184,21 +184,21 @@ fn is_valid_dword() { #[test] fn is_valid_lword() { let src = " - PROGRAM main - VAR - valid : BOOL; - invalid : BOOL; - END_VAR - VAR_TEMP - v_valid : LWORD; - v_invalid : LWORD; - END_VAR - v_valid := 2#0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; // in BCD 4_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0 => VALID - valid := IS_VALID_BCD(v_valid); - - v_invalid := 2#0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_1111; // in BCD 4_0_0_0_0_0_0_0_0_0_0_0_0_0_0_[15] => INVALID - invalid := IS_VALID_BCD(v_invalid); - END_PROGRAM"; + PROGRAM main + VAR + valid : BOOL; + invalid : BOOL; + END_VAR + VAR_TEMP + v_valid : LWORD; + v_invalid : LWORD; + END_VAR + v_valid := 2#0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000; // in BCD 4_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0 => VALID + valid := IS_VALID_BCD(v_valid); + + v_invalid := 2#0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_1111; // in BCD 4_0_0_0_0_0_0_0_0_0_0_0_0_0_0_[15] => INVALID + invalid := IS_VALID_BCD(v_invalid); + END_PROGRAM"; let sources = add_std!(src, "validation_functions.st"); let mut maintype = StructBCD::default(); let _: i64 = compile_and_run(sources, &mut maintype); diff --git a/libs/stdlib/utils/code_gen.py b/libs/stdlib/utils/code_gen.py index b061dc09c3..b73c8368a8 100644 --- a/libs/stdlib/utils/code_gen.py +++ b/libs/stdlib/utils/code_gen.py @@ -2,8 +2,18 @@ f = open("gen.txt", "w") # list of data types -types = ["LREAL", "REAL", "LINT", "DINT", "INT", - "SINT", "ULINT", "UDINT", "UINT", "USINT"] +types = [ + "LREAL", + "REAL", + "LINT", + "DINT", + "INT", + "SINT", + "ULINT", + "UDINT", + "UINT", + "USINT", +] src = """(******************** * @@ -12,9 +22,9 @@ *********************) FUNCTION {0}_TO_{1} : {1} VAR_INPUT - in : {0}; + in : {0}; END_VAR - {0}_TO_{1} := in; + {0}_TO_{1} := in; END_FUNCTION """ diff --git a/scripts/build.sh b/scripts/build.sh index 536c838940..13ec075cb9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -22,316 +22,316 @@ CONTAINER_NAME='rust-llvm' source "${BASH_SOURCE%/*}/common.sh" function set_cargo_options() { - CARGO_OPTIONS="" - if [[ $debug -ne 0 ]]; then - CARGO_OPTIONS="$CARGO_OPTIONS --verbose" - fi - if [[ $release -ne 0 ]]; then - CARGO_OPTIONS="$CARGO_OPTIONS --release" - fi - if [[ $offline -ne 0 ]]; then - CARGO_OPTIONS="$CARGO_OPTIONS --frozen" - fi - echo "$CARGO_OPTIONS" + CARGO_OPTIONS="" + if [[ $debug -ne 0 ]]; then + CARGO_OPTIONS="$CARGO_OPTIONS --verbose" + fi + if [[ $release -ne 0 ]]; then + CARGO_OPTIONS="$CARGO_OPTIONS --release" + fi + if [[ $offline -ne 0 ]]; then + CARGO_OPTIONS="$CARGO_OPTIONS --frozen" + fi + echo "$CARGO_OPTIONS" } function run_coverage() { - log "Exporting Flags" - export RUSTFLAGS="-C instrument-coverage" - export LLVM_PROFILE_FILE="rusty-%p-%m.profraw" - - log "Cleaning before build" - cargo clean - log "Building coverage" - cargo build --workspace - log "Running coverage tests" - cargo test --workspace - log "Collecting coverage results" - grcov . --binary-path ./target/debug/ -s . -t lcov --branch \ - --ignore "/*" \ - --ignore "src/main.rs" \ - --ignore "src/*/tests.rs" \ - --ignore "src/*/tests/*" \ - --ignore "tests/*" \ - --ignore "src/lexer/tokens.rs" \ - --ignore-not-existing -o lcov.info + log "Exporting Flags" + export RUSTFLAGS="-C instrument-coverage" + export LLVM_PROFILE_FILE="rusty-%p-%m.profraw" + + log "Cleaning before build" + cargo clean + log "Building coverage" + cargo build --workspace + log "Running coverage tests" + cargo test --workspace + log "Collecting coverage results" + grcov . --binary-path ./target/debug/ -s . -t lcov --branch \ + --ignore "/*" \ + --ignore "src/main.rs" \ + --ignore "src/*/tests.rs" \ + --ignore "src/*/tests/*" \ + --ignore "tests/*" \ + --ignore "src/lexer/tokens.rs" \ + --ignore-not-existing -o lcov.info } function run_build() { - CARGO_OPTIONS=$(set_cargo_options) - - # Run cargo build with release or debug flags - echo "Build starting" - echo "-----------------------------------" - cmd="cargo build $CARGO_OPTIONS " - log "Running $cmd" - eval "$cmd" - echo "-----------------------------------" - if [[ ${PIPESTATUS[0]} -ne 0 ]]; then - echo "Build failed" - exit 1 - else - echo "Build done" - fi + CARGO_OPTIONS=$(set_cargo_options) + + # Run cargo build with release or debug flags + echo "Build starting" + echo "-----------------------------------" + cmd="cargo build $CARGO_OPTIONS " + log "Running $cmd" + eval "$cmd" + echo "-----------------------------------" + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + echo "Build failed" + exit 1 + else + echo "Build done" + fi } # Builds with set targets, useful for standard functions function run_std_build() { - CARGO_OPTIONS=$(set_cargo_options) - - # if the targets are set, we will build once per target - - # Run cargo build with release or debug flags - echo "Build starting" - echo "-----------------------------------" - cmd="cargo build $CARGO_OPTIONS -p iec61131std" - if [[ ! -z $target ]]; then - for val in ${target//,/ } - do - new_cmd="$cmd --target=$val" - log "Running $new_cmd" - eval "$new_cmd" - echo "-----------------------------------" - if [[ ${PIPESTATUS[0]} -ne 0 ]]; then - echo "Build $val failed" - exit 1 - else - echo "Build $val done" - fi - done - else - log "Running $cmd" - eval "$cmd" - echo "-----------------------------------" - if [[ ${PIPESTATUS[0]} -ne 0 ]]; then - echo "Build failed" - exit 1 - else - echo "Build done" - fi - fi + CARGO_OPTIONS=$(set_cargo_options) + + # if the targets are set, we will build once per target + + # Run cargo build with release or debug flags + echo "Build starting" + echo "-----------------------------------" + cmd="cargo build $CARGO_OPTIONS -p iec61131std" + if [[ ! -z $target ]]; then + for val in ${target//,/ } + do + new_cmd="$cmd --target=$val" + log "Running $new_cmd" + eval "$new_cmd" + echo "-----------------------------------" + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + echo "Build $val failed" + exit 1 + else + echo "Build $val done" + fi + done + else + log "Running $cmd" + eval "$cmd" + echo "-----------------------------------" + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then + echo "Build failed" + exit 1 + else + echo "Build done" + fi + fi } function run_check() { - CARGO_OPTIONS=$(set_cargo_options) - log "Running cargo check" + CARGO_OPTIONS=$(set_cargo_options) + log "Running cargo check" - cargo check $CARGO_OPTIONS --workspace + cargo check $CARGO_OPTIONS --workspace } function run_doc() { - CARGO_OPTIONS=$(set_cargo_options) - log "Running cargo doc --workspace $CARGO_OPTIONS" - cargo doc --workspace $CARGO_OPTIONS - log "Building book" - cd book && mdbook build && mdbook test + CARGO_OPTIONS=$(set_cargo_options) + log "Running cargo doc --workspace $CARGO_OPTIONS" + cargo doc --workspace $CARGO_OPTIONS + log "Building book" + cd book && mdbook build && mdbook test } function run_check_style() { - CARGO_OPTIONS=$(set_cargo_options) - log "Running cargo clippy" - cargo clippy $CARGO_OPTIONS --workspace -- -Dwarnings - log "Running cargo fmt check" - cargo fmt -- --check + CARGO_OPTIONS=$(set_cargo_options) + log "Running cargo clippy" + cargo clippy $CARGO_OPTIONS --workspace -- -Dwarnings + log "Running cargo fmt check" + cargo fmt -- --check } function run_test() { - CARGO_OPTIONS=$(set_cargo_options) - log "Running cargo test" - if [[ $junit -ne 0 ]]; then - #Delete the test results if they exist - rm -rf "$project_location/test_results" - make_dir "$project_location/test_results" - # JUnit test should run on nightly - log "cargo +nightly test $CARGO_OPTIONS --lib -- --format=junit \ - -Zunstable-options \ - | split -l1 - "$project_location"/test_results/unit_tests \ - -d --additional-suffix=.xml - " - cargo +nightly test $CARGO_OPTIONS --lib -- --format=junit \ - -Zunstable-options \ - | split -l1 - "$project_location"/test_results/unit_tests \ - -d --additional-suffix=.xml - - # Run only the integration tests - #https://stackoverflow.com/questions/62447864/how-can-i-run-only-integration-tests - log "cargo +nightly test $CARGO_OPTIONS --test '*' -- --format=junit \ - -Zunstable-options \ - | split -l1 - "$project_location"/test_results/integration_tests \ - -d --additional-suffix=.xml" - cargo +nightly test $CARGO_OPTIONS --test '*' -- --format=junit \ - -Zunstable-options \ - | split -l1 - "$project_location"/test_results/integration_tests \ - -d --additional-suffix=.xml - - # Run the std integration - log "cargo +nightly test $CARGO_OPTIONS -p iec61131std --test '*' -- --format=junit \ - -Zunstable-options \ - | split -l1 - "$project_location"/test_results/std_integration_tests \ - -d --additional-suffix=.xml" - cargo +nightly test $CARGO_OPTIONS -p iec61131std --test '*' -- --format=junit \ - -Zunstable-options \ - | split -l1 - "$project_location"/test_results/std_integration_tests \ - -d --additional-suffix=.xml - else - cargo test $CARGO_OPTIONS --workspace - fi + CARGO_OPTIONS=$(set_cargo_options) + log "Running cargo test" + if [[ $junit -ne 0 ]]; then + #Delete the test results if they exist + rm -rf "$project_location/test_results" + make_dir "$project_location/test_results" + # JUnit test should run on nightly + log "cargo +nightly test $CARGO_OPTIONS --lib -- --format=junit \ + -Zunstable-options \ + | split -l1 - "$project_location"/test_results/unit_tests \ + -d --additional-suffix=.xml + " + cargo +nightly test $CARGO_OPTIONS --lib -- --format=junit \ + -Zunstable-options \ + | split -l1 - "$project_location"/test_results/unit_tests \ + -d --additional-suffix=.xml + + # Run only the integration tests + #https://stackoverflow.com/questions/62447864/how-can-i-run-only-integration-tests + log "cargo +nightly test $CARGO_OPTIONS --test '*' -- --format=junit \ + -Zunstable-options \ + | split -l1 - "$project_location"/test_results/integration_tests \ + -d --additional-suffix=.xml" + cargo +nightly test $CARGO_OPTIONS --test '*' -- --format=junit \ + -Zunstable-options \ + | split -l1 - "$project_location"/test_results/integration_tests \ + -d --additional-suffix=.xml + + # Run the std integration + log "cargo +nightly test $CARGO_OPTIONS -p iec61131std --test '*' -- --format=junit \ + -Zunstable-options \ + | split -l1 - "$project_location"/test_results/std_integration_tests \ + -d --additional-suffix=.xml" + cargo +nightly test $CARGO_OPTIONS -p iec61131std --test '*' -- --format=junit \ + -Zunstable-options \ + | split -l1 - "$project_location"/test_results/std_integration_tests \ + -d --additional-suffix=.xml + else + cargo test $CARGO_OPTIONS --workspace + fi } function generate_sources() { - log "Collecting 3rd party sources" - cargo vendor 3rd-party --versioned-dirs - log "Packaging all sources into sources.zip" - zip -r sources.zip ./ -x "output/*" -x "target/*" -x ".git/*" -q + log "Collecting 3rd party sources" + cargo vendor 3rd-party --versioned-dirs + log "Packaging all sources into sources.zip" + zip -r sources.zip ./ -x "output/*" -x "target/*" -x ".git/*" -q } function set_offline() { - log "Vendor location set, using offline build" - log "Copy the offline.toml config to build/.cargo/config.toml" - make_dir "$BUILD_DIR"/.cargo - cp "$project_location"/scripts/data/offline.toml "$BUILD_DIR"/.cargo/config.toml - if [[ ! -d $project_location/3rd-party ]]; then - echo "Offline sources not found at $project_location/3rd-party" - exit 1 - fi + log "Vendor location set, using offline build" + log "Copy the offline.toml config to build/.cargo/config.toml" + make_dir "$BUILD_DIR"/.cargo + cp "$project_location"/scripts/data/offline.toml "$BUILD_DIR"/.cargo/config.toml + if [[ ! -d $project_location/3rd-party ]]; then + echo "Offline sources not found at $project_location/3rd-party" + exit 1 + fi } function run_package_std() { - cc=$(get_compiler) - log "Packaging Standard functions" - log "Removing previous output folder" - rm -rf $OUTPUT_DIR - target_dir="$project_location/target" - include_dir=$OUTPUT_DIR/include - make_dir $include_dir - #Copy the iec61131-st folder - cp -r "$project_location"/libs/stdlib/iec61131-st/*.st "$include_dir" - - if [[ ! -z $target ]]; then - for val in ${target//,/ } - do - lib_dir=$OUTPUT_DIR/$val/lib - make_dir $lib_dir - rel_dir="$target_dir/$val" - if [[ $release -ne 0 ]]; then - rel_dir="$rel_dir/release" - else - rel_dir="$rel_dir/debug" - fi - if [[ ! -d "$rel_dir" ]]; then - echo "Compilation directory $rel_dir not found" - exit 1 - fi - cp "$rel_dir/"*.a "$lib_dir" 2>/dev/null || log "$rel_dir does not contain *.a files" - # Create an SO file from the copied a file - log "Creating a shared library from the compiled static library" - log "Running : $cc --shared -L$lib_dir \ - -Wl,--whole-archive -liec61131std \ - -o $lib_dir/out.so -Wl,--no-whole-archive \ - -lm \ - -fuse-ld=lld \ - --target=$val" - $cc --shared -L"$lib_dir" \ - -Wl,--whole-archive -liec61131std \ - -o "$lib_dir/out.so" -Wl,--no-whole-archive \ - -lm \ - -fuse-ld=lld \ - --target="$val" - - mv "$lib_dir/out.so" "$lib_dir/libiec61131std.so" - done - else - lib_dir=$OUTPUT_DIR/lib - make_dir $lib_dir - if [[ $release -ne 0 ]]; then - rel_dir="$target_dir/release" - else - rel_dir="$target_dir/debug" - fi - cp "$rel_dir/"*.a "$lib_dir" 2>/dev/null || log "$rel_dir does not contain *.a files" - # Create an SO file from the copied a file - log "Creating a shared library from the compiled static library" - log "Running : $cc --shared -L"$lib_dir" \ - -Wl,--whole-archive -liec61131std \ - -o "$lib_dir/out.so" -Wl,--no-whole-archive \ - -lm \ - -fuse-ld=lld " - $cc --shared -L"$lib_dir" \ - -Wl,--whole-archive -liec61131std \ - -o "$lib_dir/out.so" -Wl,--no-whole-archive \ - -lm \ - -fuse-ld=lld - mv "$lib_dir/out.so" "$lib_dir/libiec61131std.so" - fi - - log "Enabling read/write on the output folder" - chmod a+rw $OUTPUT_DIR -R + cc=$(get_compiler) + log "Packaging Standard functions" + log "Removing previous output folder" + rm -rf $OUTPUT_DIR + target_dir="$project_location/target" + include_dir=$OUTPUT_DIR/include + make_dir $include_dir + #Copy the iec61131-st folder + cp -r "$project_location"/libs/stdlib/iec61131-st/*.st "$include_dir" + + if [[ ! -z $target ]]; then + for val in ${target//,/ } + do + lib_dir=$OUTPUT_DIR/$val/lib + make_dir $lib_dir + rel_dir="$target_dir/$val" + if [[ $release -ne 0 ]]; then + rel_dir="$rel_dir/release" + else + rel_dir="$rel_dir/debug" + fi + if [[ ! -d "$rel_dir" ]]; then + echo "Compilation directory $rel_dir not found" + exit 1 + fi + cp "$rel_dir/"*.a "$lib_dir" 2>/dev/null || log "$rel_dir does not contain *.a files" + # Create an SO file from the copied a file + log "Creating a shared library from the compiled static library" + log "Running : $cc --shared -L$lib_dir \ + -Wl,--whole-archive -liec61131std \ + -o $lib_dir/out.so -Wl,--no-whole-archive \ + -lm \ + -fuse-ld=lld \ + --target=$val" + $cc --shared -L"$lib_dir" \ + -Wl,--whole-archive -liec61131std \ + -o "$lib_dir/out.so" -Wl,--no-whole-archive \ + -lm \ + -fuse-ld=lld \ + --target="$val" + + mv "$lib_dir/out.so" "$lib_dir/libiec61131std.so" + done + else + lib_dir=$OUTPUT_DIR/lib + make_dir $lib_dir + if [[ $release -ne 0 ]]; then + rel_dir="$target_dir/release" + else + rel_dir="$target_dir/debug" + fi + cp "$rel_dir/"*.a "$lib_dir" 2>/dev/null || log "$rel_dir does not contain *.a files" + # Create an SO file from the copied a file + log "Creating a shared library from the compiled static library" + log "Running : $cc --shared -L"$lib_dir" \ + -Wl,--whole-archive -liec61131std \ + -o "$lib_dir/out.so" -Wl,--no-whole-archive \ + -lm \ + -fuse-ld=lld " + $cc --shared -L"$lib_dir" \ + -Wl,--whole-archive -liec61131std \ + -o "$lib_dir/out.so" -Wl,--no-whole-archive \ + -lm \ + -fuse-ld=lld + mv "$lib_dir/out.so" "$lib_dir/libiec61131std.so" + fi + + log "Enabling read/write on the output folder" + chmod a+rw $OUTPUT_DIR -R } function run_in_container() { - container_engine=$(get_container_engine) - params="" - options="" - - if [[ $offline -ne 0 ]]; then - params="$params --offline" - fi - if [[ $debug -ne 0 ]]; then - params="$params --verbose" - fi - if [[ $check -ne 0 ]]; then - params="$params --check" - fi - if [[ $check_style -ne 0 ]]; then - params="$params --check-style" - fi - if [[ $build -ne 0 ]]; then - params="$params --build" - fi - if [[ $release -ne 0 ]]; then - params="$params --release" - fi - if [[ $coverage -ne 0 ]]; then - params="$params --coverage" - fi - if [[ $test -ne 0 ]]; then - params="$params --test" - fi - if [[ $junit -ne 0 ]]; then - params="$params --junit" - fi - if [[ $doc -ne 0 ]]; then - params="$params --doc" - fi - if [[ $package -ne 0 ]]; then - params="$params --package" - fi - if [[ ! -z $target ]]; then - params="$params --target $target" - fi - - volume_target="/build" - unameOut="$(uname -s)" - case "${unameOut}" in - Linux*) - volume_target="/build" - ;; - MINGW* | cygwin*) - volume_target="C:\\\\build" - ;; - *) - echo "Unsupported os $unameOut" - exit 1 - esac - - build_location=$(sanitize_path "$project_location") - log "Sanitized Project location : $project_location" - - command_to_run="$container_engine run $options -v $build_location:$volume_target $CONTAINER_NAME scripts/build.sh $params" - log "Running command : $command_to_run" - eval "$command_to_run" + container_engine=$(get_container_engine) + params="" + options="" + + if [[ $offline -ne 0 ]]; then + params="$params --offline" + fi + if [[ $debug -ne 0 ]]; then + params="$params --verbose" + fi + if [[ $check -ne 0 ]]; then + params="$params --check" + fi + if [[ $check_style -ne 0 ]]; then + params="$params --check-style" + fi + if [[ $build -ne 0 ]]; then + params="$params --build" + fi + if [[ $release -ne 0 ]]; then + params="$params --release" + fi + if [[ $coverage -ne 0 ]]; then + params="$params --coverage" + fi + if [[ $test -ne 0 ]]; then + params="$params --test" + fi + if [[ $junit -ne 0 ]]; then + params="$params --junit" + fi + if [[ $doc -ne 0 ]]; then + params="$params --doc" + fi + if [[ $package -ne 0 ]]; then + params="$params --package" + fi + if [[ ! -z $target ]]; then + params="$params --target $target" + fi + + volume_target="/build" + unameOut="$(uname -s)" + case "${unameOut}" in + Linux*) + volume_target="/build" + ;; + MINGW* | cygwin*) + volume_target="C:\\\\build" + ;; + *) + echo "Unsupported os $unameOut" + exit 1 + esac + + build_location=$(sanitize_path "$project_location") + log "Sanitized Project location : $project_location" + + command_to_run="$container_engine run $options -v $build_location:$volume_target $CONTAINER_NAME scripts/build.sh $params" + log "Running command : $command_to_run" + eval "$command_to_run" } # More safety, by turning some bugs into errors. @@ -340,79 +340,79 @@ set -o errexit -o pipefail -o noclobber -o nounset OPTIONS=sorbvc LONGOPTS=sources,offline,release,check,check-style,build,doc,test,junit,verbose,container,linux,container-name:,coverage,package,target: -check_env +check_env # -activate quoting/enhanced mode (e.g. by writing out “--options”) # -pass arguments only via -- "$@" to separate them correctly ! PARSED=$(getopt --options="$OPTIONS" --longoptions="$LONGOPTS" --name "$0" -- "$@") if [[ ${PIPESTATUS[0]} -ne 0 ]]; then - exit 2 + exit 2 fi # read getopt’s output this way to handle the quoting right: eval set -- "$PARSED" while true; do - case "$1" in - -s|--sources) - vendor=1 - ;; - -o|--offline) - offline=1 - ;; - -r|--release) - release=1 - ;; - -v|--verbose) - debug=1 - ;; - -c|--container) - container=1 - ;; - --container-name) - shift; - CONTAINER_NAME=$1 - ;; - --linux) - assume_linux=1 - ;; - --check-style) - check_style=1 - ;; - --doc) - doc=1 - ;; - --check) - check=1 - ;; - -b|--build) - build=1 - ;; - --test) - test=1 - ;; - --junit) - junit=1 - ;; - --coverage) - coverage=1 - ;; - --package) - package=1 - ;; - --target) - shift - target=$1 - ;; - --) - shift - break - ;; - *) - echo "Programming error" - exit 3 - ;; - esac - shift + case "$1" in + -s|--sources) + vendor=1 + ;; + -o|--offline) + offline=1 + ;; + -r|--release) + release=1 + ;; + -v|--verbose) + debug=1 + ;; + -c|--container) + container=1 + ;; + --container-name) + shift; + CONTAINER_NAME=$1 + ;; + --linux) + assume_linux=1 + ;; + --check-style) + check_style=1 + ;; + --doc) + doc=1 + ;; + --check) + check=1 + ;; + -b|--build) + build=1 + ;; + --test) + test=1 + ;; + --junit) + junit=1 + ;; + --coverage) + coverage=1 + ;; + --package) + package=1 + ;; + --target) + shift + target=$1 + ;; + --) + shift + break + ;; + *) + echo "Programming error" + exit 3 + ;; + esac + shift done project_location=$(find_project_root) @@ -420,67 +420,67 @@ log "Moving to project level directory $project_location" cd "$project_location" if [[ $container -ne 0 ]]; then - log "Container Build" - run_in_container - exit 0 + log "Container Build" + run_in_container + exit 0 fi if [[ $package -ne 0 ]]; then - OUTPUT_DIR=$project_location/output - make_dir "$OUTPUT_DIR" + OUTPUT_DIR=$project_location/output + make_dir "$OUTPUT_DIR" fi if [[ $vendor -ne 0 ]]; then - generate_sources - exit 0 + generate_sources + exit 0 fi if [[ $offline -ne 0 ]]; then - BUILD_DIR=$project_location/build - make_dir "$BUILD_DIR" - set_offline - log "Moving into $BUILD_DIR" - cd "$BUILD_DIR" + BUILD_DIR=$project_location/build + make_dir "$BUILD_DIR" + set_offline + log "Moving into $BUILD_DIR" + cd "$BUILD_DIR" fi if [[ $check -ne 0 ]]; then - run_check + run_check fi if [[ $check_style -ne 0 ]]; then - run_check_style + run_check_style fi if [[ $build -ne 0 ]]; then - run_build - #Build the standard functions - run_std_build + run_build + #Build the standard functions + run_std_build fi if [[ $package -ne 0 ]]; then - run_package_std + run_package_std fi if [[ $test -ne 0 ]]; then - run_test + run_test fi if [[ $doc -ne 0 ]]; then - run_doc + run_doc fi if [[ $coverage -ne 0 ]]; then - run_coverage + run_coverage fi if [[ -d $project_location/target/ ]]; then - log "Allow access to target folders" - chmod a+rw -R $project_location/target/ + log "Allow access to target folders" + chmod a+rw -R $project_location/target/ fi if [[ $offline -ne 0 ]]; then - log "Removing temporary build directory : $BUILD_DIR" - rm -rf "$BUILD_DIR" + log "Removing temporary build directory : $BUILD_DIR" + rm -rf "$BUILD_DIR" fi echo "Done" diff --git a/scripts/cargo_watch.sh b/scripts/cargo_watch.sh index 2d3f76b6f7..929d1a5d13 100755 --- a/scripts/cargo_watch.sh +++ b/scripts/cargo_watch.sh @@ -1,9 +1,9 @@ #!/bin/bash -if [ ! -z "$1" ] && [ $1 == '--container' ] +if [ ! -z "$1" ] && [ $1 == '--container' ] then cargo watch -x 'test --target-dir /tmp/target' else cargo watch -x test -fi \ No newline at end of file +fi diff --git a/scripts/common.sh b/scripts/common.sh index ec6abae1fc..6fd6d01e2d 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -2,89 +2,89 @@ debug=0 function log() { - if [[ $debug -ne 0 ]]; then - >&2 echo "$1" - fi + if [[ $debug -ne 0 ]]; then + >&2 echo "$1" + fi } function make_dir() { if [[ ! -d $1 ]]; then - log "Creating a target build directory at $1" - mkdir -p "$1" + log "Creating a target build directory at $1" + mkdir -p "$1" fi } function check_env() { - # -allow a command to fail with !’s side effect on errexit - # -use return value from ${PIPESTATUS[0]}, because ! hosed $? + # -allow a command to fail with !’s side effect on errexit + # -use return value from ${PIPESTATUS[0]}, because ! hosed $? - ! getopt --test > /dev/null - if [[ ${PIPESTATUS[0]} -ne 4 ]]; then - echo 'Error: extended getopts needed' - exit 1 - fi + ! getopt --test > /dev/null + if [[ ${PIPESTATUS[0]} -ne 4 ]]; then + echo 'Error: extended getopts needed' + exit 1 + fi } function get_compiler() { - log "Trying clang" - res= - if command -v clang &> /dev/null - then - log "Found clang, using as default" - res=clang - else - log "Trying clang-14" - if command -v clang-14 &> /dev/null - then - log "Found clang, using as default" - res=clang-14 - else - echo 'Error : clang / clang-14 not found' - exit 1 - fi - fi - log "Compiler found : $res" - echo $res + log "Trying clang" + res= + if command -v clang &> /dev/null + then + log "Found clang, using as default" + res=clang + else + log "Trying clang-14" + if command -v clang-14 &> /dev/null + then + log "Found clang, using as default" + res=clang-14 + else + echo 'Error : clang / clang-14 not found' + exit 1 + fi + fi + log "Compiler found : $res" + echo $res } function get_container_engine() { - log "Trying docker" - if command -v docker &> /dev/null - then - container_engine=docker - else - >&2 log "Docker not found, trying podman" - if command -v podman &> /dev/null - then - container_engine=podman - else - echo "Docker or podman not found" - exit 1 - fi - fi - log "container engine found : $container_engine" - echo $container_engine + log "Trying docker" + if command -v docker &> /dev/null + then + container_engine=docker + else + >&2 log "Docker not found, trying podman" + if command -v podman &> /dev/null + then + container_engine=podman + else + echo "Docker or podman not found" + exit 1 + fi + fi + log "container engine found : $container_engine" + echo $container_engine } function find_project_root() { - log "Locating project root" - if command -v cargo &> /dev/null - then - log "Using cargo" - project_location=$(cargo locate-project --message-format plain) - project_location=$(dirname "$project_location") - else - log "Cargo not found, using script location" - project_location="${BASH_SOURCE%/*/..}" - project_location=$(dirname $(readlink -f "$project_location")) - fi - log "Found project location at $project_location" - # echo $project_location | tr -t "\\" "\\\\" - echo $project_location + log "Locating project root" + if command -v cargo &> /dev/null + then + log "Using cargo" + project_location=$(cargo locate-project --message-format plain) + project_location=$(dirname "$project_location") + else + log "Cargo not found, using script location" + project_location="${BASH_SOURCE%/*/..}" + project_location=$(dirname $(readlink -f "$project_location")) + fi + log "Found project location at $project_location" + # echo $project_location | tr -t "\\" "\\\\" + echo $project_location } function sanitize_path() { - target=$1 - echo "${target//\\/\\\\}" -} \ No newline at end of file + target=$1 + echo "${target//\\/\\\\}" +} diff --git a/src/codegen/generators/llvm.rs b/src/codegen/generators/llvm.rs index e1a9b84587..6023dc3b15 100644 --- a/src/codegen/generators/llvm.rs +++ b/src/codegen/generators/llvm.rs @@ -67,7 +67,7 @@ impl<'a> Llvm<'a> { /// - `module` the compilation module to add the variable /// - `name` the name of the global variable /// - `data_type` the variable's datatype - /// - `initial_value` an optional initial value of the global variable + /// - `initial_value` an optional initial value of the global variable pub fn create_global_variable( &self, module: &Module<'a>, diff --git a/src/codegen/generators/pou_generator.rs b/src/codegen/generators/pou_generator.rs index e977f45ace..fd12513cc1 100644 --- a/src/codegen/generators/pou_generator.rs +++ b/src/codegen/generators/pou_generator.rs @@ -167,8 +167,8 @@ impl<'ink, 'cg> PouGenerator<'ink, 'cg> { .map(|(i, p)| match declared_parameters.get(i) { Some(v) if v.is_in_parameter_by_ref() && - // parameters by ref will always be a pointer - p.into_pointer_type().get_element_type().is_array_type() => + // parameters by ref will always be a pointer + p.into_pointer_type().get_element_type().is_array_type() => { // for array types we will generate a pointer to the arrays element type // not a pointer to array diff --git a/src/codegen/tests/code_gen_tests.rs b/src/codegen/tests/code_gen_tests.rs index 5e6ce9b51d..c33f22b07d 100644 --- a/src/codegen/tests/code_gen_tests.rs +++ b/src/codegen/tests/code_gen_tests.rs @@ -38,7 +38,7 @@ fn empty_statements_dont_generate_anything() { fn external_program_global_var_is_external() { let result = codegen( r#" - @EXTERNAL + @EXTERNAL PROGRAM prg VAR x : DINT; y : DINT; END_VAR x; @@ -179,7 +179,7 @@ END_VAR // to result in an DINT (i32) and then truncated back // to i16 again - z := x + INT#7; + z := x + INT#7; END_PROGRAM "#, @@ -195,8 +195,8 @@ VAR x : DINT; END_VAR - x := INT#16#FFFF; - x := WORD#16#FFFF; + x := INT#16#FFFF; + x := WORD#16#FFFF; END_PROGRAM "#, @@ -214,7 +214,7 @@ z : REAL; END_VAR // the LREAL# should fource a double addition - z := x + LREAL#7.7; + z := x + LREAL#7.7; END_PROGRAM "#, @@ -232,10 +232,10 @@ z : REAL; END_VAR // the REAL# should prevent this addition - // to result in an DINT (i32) and then result + // to result in an DINT (i32) and then result // in an i32 devision - z := x / REAL#7; + z := x / REAL#7; END_PROGRAM "#, @@ -253,10 +253,10 @@ z : INT; END_VAR // the INT# should prevent this addition - // to result in an DINT (i32) and then + // to result in an DINT (i32) and then // truncated back to i16 - z := x + INT#16#D; + z := x + INT#16#D; END_PROGRAM "#, @@ -293,10 +293,10 @@ VAR z : BOOL; END_VAR - z := BOOL#TRUE; - z := BOOL#FALSE; - z := BOOL#1; - z := BOOL#0; + z := BOOL#TRUE; + z := BOOL#FALSE; + z := BOOL#1; + z := BOOL#0; END_PROGRAM "#, @@ -717,7 +717,7 @@ fn program_with_xor_statement() { VAR x : BOOL; y : BOOL; -z : BOOL; +z : BOOL; END_VAR z := x XOR y; END_PROGRAM @@ -780,7 +780,7 @@ fn program_with_signed_combined_expressions() { fn if_elsif_else_generator_test() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; y : DINT; @@ -809,7 +809,7 @@ fn if_elsif_else_generator_test() { fn if_generator_test() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; b1 : BOOL; @@ -827,7 +827,7 @@ fn if_generator_test() { fn if_with_expression_generator_test() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; b1 : BOOL; @@ -845,11 +845,11 @@ fn if_with_expression_generator_test() { fn for_statement_with_steps_test() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR - FOR x := 3 TO 10 BY 7 DO + FOR x := 3 TO 10 BY 7 DO x; END_FOR END_PROGRAM @@ -863,7 +863,7 @@ fn for_statement_with_steps_test() { fn for_statement_with_continue() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -882,11 +882,11 @@ fn for_statement_with_continue() { fn for_statement_with_exit() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR - FOR x := 3 TO 10 BY 7 DO + FOR x := 3 TO 10 BY 7 DO x := x + 2; EXIT; x := x + 5; @@ -906,11 +906,11 @@ fn class_method_in_pou() { VAR x, y : INT; END_VAR - + METHOD testMethod VAR_INPUT myMethodArg : INT; END_VAR VAR myMethodLocalVar : INT; END_VAR - + x := myMethodArg; y := x; myMethodLocalVar = y; @@ -940,11 +940,11 @@ fn fb_method_in_pou() { VAR x, y : INT; END_VAR - + METHOD testMethod VAR_INPUT myMethodArg : INT; END_VAR VAR myMethodLocalVar : INT; END_VAR - + x := myMethodArg; y := x; myMethodLocalVar = y; @@ -1008,11 +1008,11 @@ fn class_member_access_from_method() { VAR x, y : INT; END_VAR - + METHOD testMethod VAR_INPUT myMethodArg : INT; END_VAR VAR myMethodLocalVar : INT; END_VAR - + x := myMethodArg; y := x; myMethodLocalVar = y; @@ -1028,7 +1028,7 @@ fn class_member_access_from_method() { fn while_loop_with_if_exit() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1048,11 +1048,11 @@ fn while_loop_with_if_exit() { fn for_statement_without_steps_test() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR - FOR x := 3 TO 10 DO + FOR x := 3 TO 10 DO x; END_FOR END_PROGRAM @@ -1066,11 +1066,11 @@ fn for_statement_without_steps_test() { fn for_statement_sint() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : SINT; END_VAR - FOR x := 3 TO 10 DO + FOR x := 3 TO 10 DO x; END_FOR END_PROGRAM @@ -1084,11 +1084,11 @@ fn for_statement_sint() { fn for_statement_int() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : INT; END_VAR - FOR x := 3 TO 10 DO + FOR x := 3 TO 10 DO x; END_FOR END_PROGRAM @@ -1102,11 +1102,11 @@ fn for_statement_int() { fn for_statement_lint() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : LINT; END_VAR - FOR x := 3 TO 10 DO + FOR x := 3 TO 10 DO x; END_FOR END_PROGRAM @@ -1120,11 +1120,11 @@ fn for_statement_lint() { fn for_statement_continue() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR - FOR x := 3 TO 10 DO + FOR x := 3 TO 10 DO END_FOR x; END_PROGRAM @@ -1138,14 +1138,14 @@ fn for_statement_continue() { fn for_statement_with_references_steps_test() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR step: DINT; x : DINT; y : DINT; z : DINT; END_VAR - FOR x := y TO z BY step DO + FOR x := y TO z BY step DO x; END_FOR END_PROGRAM @@ -1159,7 +1159,7 @@ fn for_statement_with_references_steps_test() { fn while_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : BOOL; END_VAR @@ -1177,7 +1177,7 @@ fn while_statement() { fn while_with_expression_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : BOOL; END_VAR @@ -1194,13 +1194,13 @@ fn while_with_expression_statement() { fn repeat_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : BOOL; END_VAR REPEAT x; - UNTIL x + UNTIL x END_REPEAT END_PROGRAM ", @@ -1213,7 +1213,7 @@ fn repeat_statement() { fn simple_case_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; y : DINT; @@ -1236,7 +1236,7 @@ fn simple_case_statement() { fn simple_case_i8_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : BYTE; y : BYTE; @@ -1259,7 +1259,7 @@ fn simple_case_i8_statement() { fn case_with_multiple_labels_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; y : DINT; @@ -1281,7 +1281,7 @@ fn case_with_multiple_labels_statement() { fn case_with_ranges_statement() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; y : DINT; @@ -1301,9 +1301,9 @@ fn case_with_constant_expressions_in_case_selectors() { let result = codegen( r##" VAR_GLOBAL CONSTANT - FORWARD : DINT := 7; - UP : DINT := FORWARD + 1; - DOWN : DINT := FORWARD + UP; + FORWARD : DINT := 7; + UP : DINT := FORWARD + 1; + DOWN : DINT := FORWARD + UP; END_VAR FUNCTION drive : DINT @@ -1312,17 +1312,17 @@ FUNCTION drive : DINT horiz, depth : DINT; END_VAR - CASE input OF - FORWARD : - horiz := horiz + 1; + CASE input OF + FORWARD : + horiz := horiz + 1; FORWARD*2: horiz := horiz + 2; - UP : - depth := depth - 1; - DOWN : - depth := depth + 1; + UP : + depth := depth - 1; + DOWN : + depth := depth + 1; - END_CASE + END_CASE END_FUNCTION "##, @@ -1353,17 +1353,17 @@ FUNCTION drive : DINT horiz, depth : DINT; END_VAR - CASE input OF - FORWARD : + CASE input OF + FORWARD : horiz := horiz + 1; FORWARD*2: horiz := horiz + 2; - UP : + UP : depth := depth - 1; - DOWN : - depth := depth + 1; + DOWN : + depth := depth + 1; - END_CASE + END_CASE END_FUNCTION "##, @@ -1382,7 +1382,7 @@ fn function_called_in_program() { foo := 1; END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1402,7 +1402,7 @@ fn real_function_called_in_program() { foo := 1.0; END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1421,7 +1421,7 @@ fn external_function_called_in_program() { @EXTERNAL FUNCTION foo : DINT END_FUNCTION - PROGRAM prg + PROGRAM prg foo(); END_PROGRAM ", @@ -1446,7 +1446,7 @@ fn nested_function_called_in_program() { foo := 1; END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1469,7 +1469,7 @@ fn function_with_parameters_called_in_program() { foo := 1; END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1493,7 +1493,7 @@ fn function_with_two_parameters_called_in_program() { foo := 1; END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1583,7 +1583,7 @@ fn program_called_in_program() { PROGRAM foo END_PROGRAM - PROGRAM prg + PROGRAM prg foo(); END_PROGRAM ", @@ -1596,7 +1596,7 @@ fn program_called_in_program() { fn action_called_in_program() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1616,7 +1616,7 @@ fn action_called_in_program() { fn qualified_local_action_called_in_program() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1639,7 +1639,7 @@ fn qualified_foreign_action_called_in_program() { PROGRAM bar prg.foo(); END_PROGRAM - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -1666,7 +1666,7 @@ fn qualified_action_from_fb_called_in_program() { fb_inst.foo(); END_PROGRAM - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR x : DINT; END_VAR @@ -1686,14 +1686,14 @@ fn qualified_action_from_fb_called_in_program() { fn program_with_two_parameters_called_in_program() { let result = codegen( " - PROGRAM foo + PROGRAM foo VAR_INPUT bar : DINT; buz : BOOL; END_VAR END_PROGRAM - PROGRAM prg + PROGRAM prg foo(2, TRUE); END_PROGRAM ", @@ -1706,14 +1706,14 @@ fn program_with_two_parameters_called_in_program() { fn program_with_two_explicit_parameters_called_in_program() { let result = codegen( " - PROGRAM foo + PROGRAM foo VAR_INPUT bar : DINT; buz : BOOL; END_VAR END_PROGRAM - PROGRAM prg + PROGRAM prg foo(buz := TRUE, bar := 2); END_PROGRAM ", @@ -1726,7 +1726,7 @@ fn program_with_two_explicit_parameters_called_in_program() { fn program_with_var_out_called_in_program() { let result = codegen( " - PROGRAM foo + PROGRAM foo VAR_INPUT bar : DINT; END_VAR @@ -1735,7 +1735,7 @@ fn program_with_var_out_called_in_program() { END_VAR END_PROGRAM - PROGRAM prg + PROGRAM prg VAR baz : BOOL; END_VAR @@ -1751,14 +1751,14 @@ fn program_with_var_out_called_in_program() { fn program_with_var_inout_called_in_program() { let result = codegen( " - PROGRAM foo + PROGRAM foo VAR_IN_OUT inout : DINT; END_VAR inout := inout + 1; END_PROGRAM - PROGRAM prg + PROGRAM prg VAR baz : DINT; END_VAR @@ -1779,19 +1779,19 @@ fn pass_inout_to_inout() { VAR_IN_OUT inout : DINT; END_VAR - VAR_INPUT + VAR_INPUT in : DINT; END_VAR END_PROGRAM - PROGRAM foo + PROGRAM foo VAR_IN_OUT inout : DINT; END_VAR foo2(inout := inout, in := inout); END_PROGRAM - PROGRAM prg + PROGRAM prg VAR baz : DINT; END_VAR @@ -1807,27 +1807,27 @@ fn pass_inout_to_inout() { fn pointers_generated() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR X : BOOL; pX : POINTER TO BOOL; rX : REF_TO BOOL; END_VAR - + //Assign address pX := NULL; rX := NULL; pX := &X; rX := &X; - //Read from pointer + //Read from pointer X := pX^; X := rX^; - //Write in pointer + //Write in pointer pX^ := X; rX^ := X; - + END_PROGRAM ", ); @@ -1839,7 +1839,7 @@ fn pointers_generated() { fn complex_pointers() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR X : INT; arrX : ARRAY[1..10] OF INT; @@ -1852,14 +1852,14 @@ fn complex_pointers() { arrrX[2] := &arrX[3]; rarrX := &arrX; - //Read from pointer + //Read from pointer X := arrrX[4]^; X := rarrX^[5]; - //Write in pointer + //Write in pointer arrrX[6]^ := X; rarrX^[7] := arrrX[8]^; - + END_PROGRAM ", ); @@ -1871,7 +1871,7 @@ fn complex_pointers() { fn pointer_and_array_access_to_in_out() { let result = codegen( " - FUNCTION main : INT + FUNCTION main : INT VAR_IN_OUT a : REF_TO INT; b : ARRAY[0..1] OF INT; @@ -1892,7 +1892,7 @@ fn pointer_and_array_access_to_in_out() { fn program_with_var_out_called_mixed_in_program() { let result = codegen( " - PROGRAM foo + PROGRAM foo VAR_INPUT bar : DINT; END_VAR @@ -1901,7 +1901,7 @@ fn program_with_var_out_called_mixed_in_program() { END_VAR END_PROGRAM - PROGRAM prg + PROGRAM prg VAR baz : BOOL; END_VAR @@ -1917,11 +1917,11 @@ fn program_with_var_out_called_mixed_in_program() { fn program_called_before_decalaration() { codegen( " - PROGRAM foo + PROGRAM foo bar(); END_PROGRAM - PROGRAM bar + PROGRAM bar END_PROGRAM ", ); @@ -1952,7 +1952,7 @@ fn function_called_when_shadowed() { foo := 1; END_FUNCTION - PROGRAM prg + PROGRAM prg VAR froo : DINT; END_VAR @@ -1975,7 +1975,7 @@ fn function_block_instance_call() { END_VAR END_FUNCTION_BLOCK - PROGRAM prg + PROGRAM prg VAR fb_inst : foo; END_VAR @@ -2028,13 +2028,13 @@ fn reference_qualified_name() { baz : fb; END_VAR END_PROGRAM - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR x := foo.x; x := foo.y; - x := foo.baz.x; + x := foo.baz.x; END_PROGRAM ", ); @@ -2086,7 +2086,7 @@ fn arrays_with_global_const_size_are_generated() { let result = codegen( " VAR_GLOBAL CONSTANT - THREE : INT := 3; + THREE : INT := 3; ZERO : INT := 0; LEN : INT := THREE * THREE; END_VAR @@ -2116,9 +2116,9 @@ fn structs_members_can_be_referenced() { END_STRUCT END_TYPE - PROGRAM MainProg + PROGRAM MainProg VAR - Cord: MyStruct; + Cord: MyStruct; END_VAR Cord.a := 0; END_PROGRAM @@ -2153,7 +2153,7 @@ fn typed_enums_are_generated() { TYPE MyEnum2: UINT(red, yellow, green); END_TYPE - + TYPE MyEnum3: DINT(red, yellow, green); END_TYPE @@ -2177,12 +2177,12 @@ fn typed_enums_are_used_properly() { TYPE MyEnum2: UINT(red := 15, yellow, green); END_TYPE - + TYPE MyEnum3: DINT(red := 25, yellow, green); END_TYPE PROGRAM prg - VAR + VAR x: BYTE; y: UINT; z: DINT; @@ -2208,7 +2208,7 @@ fn typed_enums_with_initializers_are_generated() { TYPE MyEnum2: UINT(red := 10, yellow := 11, green := 12); END_TYPE - + TYPE MyEnum3: DINT(red := 22, yellow := 33, green := 44); END_TYPE @@ -2256,7 +2256,7 @@ fn enums_custom_type_are_generated() { PROGRAM main VAR - tf1 : TrafficLight; + tf1 : TrafficLight; END_VAR END_PROGRAM ", @@ -2290,7 +2290,7 @@ fn enum_members_can_be_used_in_asignments() { fn inline_structs_are_generated() { let result = codegen( " - + VAR_GLOBAL x: STRUCT a: DINT; @@ -2308,19 +2308,19 @@ fn accessing_nested_structs() { let result = codegen( " TYPE InnerStruct: - STRUCT + STRUCT inner1 : INT; inner2 : INT; END_STRUCT END_TYPE - + TYPE OuterStruct: - STRUCT + STRUCT out1 : InnerStruct; out2 : InnerStruct; END_STRUCT END_TYPE - + PROGRAM Main VAR m : OuterStruct; @@ -2376,7 +2376,7 @@ fn basic_datatypes_generated() { fn array_of_int_type_generated() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..10] OF INT; END_VAR @@ -2391,7 +2391,7 @@ fn array_of_int_type_generated() { fn array_of_cast_int_type_generated() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..INT#16#A] OF INT; END_VAR @@ -2406,7 +2406,7 @@ fn array_of_cast_int_type_generated() { fn array_of_int_type_used() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..3] OF DINT; END_VAR @@ -2423,7 +2423,7 @@ fn array_of_int_type_used() { fn array_of_int_non_zero_type_generated() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[10..20] OF INT; END_VAR @@ -2438,7 +2438,7 @@ fn array_of_int_non_zero_type_generated() { fn array_of_int_type_with_non_zero_start_used() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[1..3] OF DINT; END_VAR @@ -2455,7 +2455,7 @@ fn array_of_int_type_with_non_zero_start_used() { fn array_of_int_non_zero_negative_type_generated() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[-10..20] OF INT; END_VAR @@ -2470,7 +2470,7 @@ fn array_of_int_non_zero_negative_type_generated() { fn array_of_int_type_with_non_zero_negative_start_used() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[-2..3] OF DINT; END_VAR @@ -2487,7 +2487,7 @@ fn array_of_int_type_with_non_zero_negative_start_used() { fn multidim_array_declaration() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..1, 2..4] OF INT; END_VAR @@ -2502,7 +2502,7 @@ fn multidim_array_declaration() { fn multidim_array_access() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..3, 1..2] OF DINT; END_VAR @@ -2519,7 +2519,7 @@ fn multidim_array_access() { fn nested_array_declaration() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[2..4] OF ARRAY[0..1] OF INT; END_VAR @@ -2534,7 +2534,7 @@ fn nested_array_declaration() { fn nested_array_access() { let result = codegen( " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..3] OF ARRAY[1..2] OF DINT; END_VAR @@ -2624,11 +2624,11 @@ fn accessing_nested_array_in_struct() { let result = codegen( " TYPE MyStruct: - STRUCT + STRUCT field1 : ARRAY[0..4] OF INT; END_STRUCT END_TYPE - + PROGRAM Main VAR m : MyStruct; @@ -2655,11 +2655,11 @@ fn sub_range_type_calls_check_function_missing() { END_VAR Check_XX_RangeSigned := value; END_FUNCTION - + PROGRAM Main VAR x : MyInt; - END_VAR + END_VAR x := 7; END_PROGRAM @@ -2683,11 +2683,11 @@ fn sub_range_type_calls_check_function_on_assigment() { END_VAR CheckRangeSigned := value; END_FUNCTION - + PROGRAM Main VAR x : MyInt; - END_VAR + END_VAR x := 7; END_PROGRAM @@ -2707,7 +2707,7 @@ fn using_global_consts_in_expressions() { cA : INT := 1; cB : INT := 2; cC : INT := cA + cB; - END_VAR + END_VAR PROGRAM prg VAR @@ -2746,9 +2746,9 @@ fn using_const_expression_in_range_type() { r#" VAR_GLOBAL CONST MIN : INT := 7; - END_VAR + END_VAR - FUNCTION CheckRangeSigned: INT + FUNCTION CheckRangeSigned: INT VAR_INPUT value : INT; lower : INT; @@ -2786,7 +2786,7 @@ fn inlined_array_size_from_local_scoped_constants() { VAR CONSTANT a : INT := 3; b : INT := 7; - END_VAR + END_VAR VAR arr : ARRAY[a..b] OF BYTE; @@ -2805,20 +2805,20 @@ fn inlined_array_size_from_local_scoped_constants() { fn program_with_chars() { let result = codegen( r#" - PROGRAM mainPROG - VAR - x : CHAR; - y : WCHAR; - END_VAR - x := 'a'; - x := ' '; + PROGRAM mainPROG + VAR + x : CHAR; + y : WCHAR; + END_VAR + x := 'a'; + x := ' '; - y := "A"; - y := " "; - y := "'"; - y := "$""; - END_PROGRAM - "#, + y := "A"; + y := " "; + y := "'"; + y := "$""; + END_PROGRAM + "#, ); insta::assert_snapshot!(result); } @@ -2827,15 +2827,15 @@ fn program_with_chars() { fn program_with_casted_chars_assignment() { let result = codegen( r#" - PROGRAM mainPROG - VAR - x : CHAR; - y : WCHAR; - END_VAR - x := CHAR#"A"; - y := WCHAR#'B'; - END_PROGRAM - "#, + PROGRAM mainPROG + VAR + x : CHAR; + y : WCHAR; + END_VAR + x := CHAR#"A"; + y := WCHAR#'B'; + END_PROGRAM + "#, ); insta::assert_snapshot!(result); } @@ -2844,15 +2844,15 @@ fn program_with_casted_chars_assignment() { fn function_call_with_same_name_as_return_type() { let result = codegen( " - FUNCTION TIME : TIME - END_FUNCTION + FUNCTION TIME : TIME + END_FUNCTION - PROGRAM prg - VAR - END_VAR - TIME(); - END_PROGRAM - ", + PROGRAM prg + VAR + END_VAR + TIME(); + END_PROGRAM + ", ); insta::assert_snapshot!(result); } @@ -2861,18 +2861,18 @@ fn function_call_with_same_name_as_return_type() { fn variable_with_same_name_as_data_type() { let result = codegen( " - FUNCTION func : TIME - VAR - TIME : TIME; - END_VAR - END_FUNCTION + FUNCTION func : TIME + VAR + TIME : TIME; + END_VAR + END_FUNCTION - PROGRAM prog - VAR - TIME : TIME; - END_VAR - END_PROGRAM - ", + PROGRAM prog + VAR + TIME : TIME; + END_VAR + END_PROGRAM + ", ); insta::assert_snapshot!(result); } @@ -2886,12 +2886,12 @@ fn variable_with_same_name_as_data_type() { fn variable_with_same_name_as_function() { let result = codegen( " - FUNCTION TIME : TIME - VAR - TIME : TIME; - END_VAR - END_FUNCTION - ", + FUNCTION TIME : TIME + VAR + TIME : TIME; + END_VAR + END_FUNCTION + ", ); insta::assert_snapshot!(result); } @@ -2900,12 +2900,12 @@ fn variable_with_same_name_as_function() { fn expression_list_as_array_initilization() { let result = codegen( " - VAR_GLOBAL - arr : ARRAY[0..3] OF INT := 1, 2, 3; - b_exp : ARRAY[0..4] OF DINT := 1+3, 2*3, 7-1, 10; - str : ARRAY[0..2] OF STRING := 'first', 'second'; - END_VAR - ", + VAR_GLOBAL + arr : ARRAY[0..3] OF INT := 1, 2, 3; + b_exp : ARRAY[0..4] OF DINT := 1+3, 2*3, 7-1, 10; + str : ARRAY[0..2] OF STRING := 'first', 'second'; + END_VAR + ", ); insta::assert_snapshot!(result); } @@ -2914,15 +2914,15 @@ fn expression_list_as_array_initilization() { fn default_values_for_not_initialized_function_vars() { let result = codegen( " - FUNCTION func : INT - VAR - int_var : INT; - arr_var : ARRAY[0..2] OF DINT; - ptr_var : REF_TO DINT; - float_var : REAL; - END_VAR - END_FUNCTION - ", + FUNCTION func : INT + VAR + int_var : INT; + arr_var : ARRAY[0..2] OF DINT; + ptr_var : REF_TO DINT; + float_var : REAL; + END_VAR + END_FUNCTION + ", ); insta::assert_snapshot!(result); } @@ -2932,15 +2932,15 @@ fn order_var_and_var_temp_block() { // GIVEN a program with defined VAR_TEMP before VAR block let result = codegen( " - PROGRAM main - VAR_TEMP - temp : INT; - END_VAR - VAR - var1 : INT; - END_VAR - END_PROGRAM - ", + PROGRAM main + VAR_TEMP + temp : INT; + END_VAR + VAR + var1 : INT; + END_VAR + END_PROGRAM + ", ); // codegen should be successful insta::assert_snapshot!(result); @@ -2951,12 +2951,12 @@ fn constant_expressions_in_ranged_type_declaration_are_propagated() { //GIVEN a ranged type from 0 .. MIN+1 where MIN is a global constant //WHEN the code is generated let result = codegen( - " + " VAR_GLOBAL CONSTANT MIN : INT := 7; - END_VAR + END_VAR - FUNCTION CheckRangeSigned: INT + FUNCTION CheckRangeSigned: INT VAR_INPUT value : INT; lower : INT; @@ -2985,8 +2985,8 @@ fn constant_expression_in_function_blocks_are_propagated() { //GIVEN a constant in a function block //WHEN the code is generated let result = codegen( - " - FUNCTION_BLOCK fbWithConstant + " + FUNCTION_BLOCK fbWithConstant VAR x : INT; END_VAR @@ -3009,7 +3009,7 @@ fn date_and_time_addition_in_var_output() { //GIVEN a date and time and a time addition on output variables //WHEN the code is generated let result = codegen( - " + " FUNCTION func : DINT VAR_OUTPUT d_and_t : DT; @@ -3049,18 +3049,18 @@ fn date_and_time_global_constants_initialize() { PROGRAM main VAR_TEMP - t1 : TIME; - t2 : TIME; - lt1 : LTIME; - lt2 : LTIME; - d1 : DATE; - d2 : DATE; - ld1 : LDATE; - ld2 : LDATE; - tod1 : TIME_OF_DAY; - tod2 : TOD; - ltod1 : LTOD; - ltod2 : LTOD; + t1 : TIME; + t2 : TIME; + lt1 : LTIME; + lt2 : LTIME; + d1 : DATE; + d2 : DATE; + ld1 : LDATE; + ld2 : LDATE; + tod1 : TIME_OF_DAY; + tod2 : TOD; + ltod1 : LTOD; + ltod2 : LTOD; dt1 : DATE_AND_TIME; dt2 : DT; ldt1 : LDT; @@ -3071,16 +3071,16 @@ fn date_and_time_global_constants_initialize() { t2 := cT_SHORT; lt1 := cLT; lt2 := cLT_SHORT; - d1 := cD; - d2 := cD_SHORT; + d1 := cD; + d2 := cD_SHORT; ld1 := cLD; ld2 := cLD_SHORT; tod1 := cTOD; tod2 := cTOD_SHORT; - ltod1 := cLTOD; - ltod2 := cLTOD_SHORT; - dt1 := cDT; - dt2 := cDT_SHORT; + ltod1 := cLTOD; + ltod2 := cLTOD_SHORT; + dt1 := cDT; + dt2 := cDT_SHORT; ldt1 := cLDT; ldt2 := cLDT_SHORT; END_PROGRAM"#; @@ -3093,7 +3093,7 @@ fn date_and_time_global_constants_initialize() { #[test] fn contants_in_case_statements_resolved() { let result = codegen( - " + " PROGRAM main VAR DAYS_IN_MONTH : DINT; @@ -3102,12 +3102,12 @@ fn contants_in_case_statements_resolved() { SIXTY : DINT := 60; END_VAR CASE DAYS_IN_MONTH OF - 32..SIXTY : DAYS_IN_MONTH := 29; - (SIXTY + 2)..70 : DAYS_IN_MONTH := 30; + 32..SIXTY : DAYS_IN_MONTH := 29; + (SIXTY + 2)..70 : DAYS_IN_MONTH := 30; ELSE DAYS_IN_MONTH := 31; END_CASE; - END_PROGRAM + END_PROGRAM ", ); @@ -3121,43 +3121,43 @@ fn sub_range_check_functions() { // GIVEN let result = codegen( " - FUNCTION CheckRangeSigned : DINT - VAR_INPUT v: DINT; low: DINT; up: DINT; END_VAR - CheckRangeSigned := -7; - END_FUNCTION - - FUNCTION CheckRangeUnsigned : UDINT - VAR_INPUT v: UDINT; low: UDINT; up: UDINT; END_VAR - CheckRangeUnsigned := 7; - END_FUNCTION - - FUNCTION CheckLRangeSigned : LINT - VAR_INPUT v: LINT; low: LINT; up: LINT; END_VAR - CheckLRangeSigned := -77; - END_FUNCTION - - FUNCTION CheckLRangeUnsigned : ULINT - VAR_INPUT v: ULINT; low: ULINT; up: ULINT; END_VAR - CheckLRangeUnsigned := 77; - END_FUNCTION - - PROGRAM main - VAR - a : BYTE(0 .. 100); - b : SINT(-100 .. 100); - c : USINT(0 .. 100); - d : WORD(0 .. 100); - e : INT(-100 .. 100); - f : UINT(0 .. 100); - g : DINT(-100 .. 100); - h : UDINT(0 .. 100); - i : LINT(-100 .. 100); - j : ULINT(0 .. 100); - END_VAR - a := 1; b := 1; c := 1; d := 1; e := 1; - f := 1; g := 1; h := 1; i := 1; j := 1; - END_PROGRAM - ", + FUNCTION CheckRangeSigned : DINT + VAR_INPUT v: DINT; low: DINT; up: DINT; END_VAR + CheckRangeSigned := -7; + END_FUNCTION + + FUNCTION CheckRangeUnsigned : UDINT + VAR_INPUT v: UDINT; low: UDINT; up: UDINT; END_VAR + CheckRangeUnsigned := 7; + END_FUNCTION + + FUNCTION CheckLRangeSigned : LINT + VAR_INPUT v: LINT; low: LINT; up: LINT; END_VAR + CheckLRangeSigned := -77; + END_FUNCTION + + FUNCTION CheckLRangeUnsigned : ULINT + VAR_INPUT v: ULINT; low: ULINT; up: ULINT; END_VAR + CheckLRangeUnsigned := 77; + END_FUNCTION + + PROGRAM main + VAR + a : BYTE(0 .. 100); + b : SINT(-100 .. 100); + c : USINT(0 .. 100); + d : WORD(0 .. 100); + e : INT(-100 .. 100); + f : UINT(0 .. 100); + g : DINT(-100 .. 100); + h : UDINT(0 .. 100); + i : LINT(-100 .. 100); + j : ULINT(0 .. 100); + END_VAR + a := 1; b := 1; c := 1; d := 1; e := 1; + f := 1; g := 1; h := 1; i := 1; j := 1; + END_PROGRAM + ", ); // THEN for every assignment a check function should be called @@ -3202,7 +3202,7 @@ fn reference_to_reference_assignments_in_function_arguments() { input2 := REF(global2), input3 := &global3 ); - + prog( // These are not valid but we want to see if there's a cast involved input1 := ADR(global4), @@ -3219,7 +3219,7 @@ fn reference_to_reference_assignments_in_function_arguments() { #[test] fn sizeof_works_in_binary_expression_with_different_size() { let result = codegen( - r#" + r#" FUNCTION main : DINT VAR i : DINT; diff --git a/src/codegen/tests/codegen_error_messages_tests.rs b/src/codegen/tests/codegen_error_messages_tests.rs index f2b1418274..39b6395e77 100644 --- a/src/codegen/tests/codegen_error_messages_tests.rs +++ b/src/codegen/tests/codegen_error_messages_tests.rs @@ -6,7 +6,7 @@ use insta::assert_snapshot; fn unknown_reference_should_be_reported_with_line_number() { let result = codegen_without_unwrap( " - PROGRAM prg + PROGRAM prg VAR x : INT; END_VAR @@ -25,7 +25,7 @@ fn unknown_reference_should_be_reported_with_line_number() { fn exit_not_in_loop() { let result = codegen_without_unwrap( " - PROGRAM prg + PROGRAM prg VAR x : INT; END_VAR @@ -44,7 +44,7 @@ fn exit_not_in_loop() { fn continue_not_in_loop() { let result = codegen_without_unwrap( " - PROGRAM prg + PROGRAM prg VAR x : INT; END_VAR @@ -65,13 +65,13 @@ fn unknown_struct_field_should_be_reported_with_line_number() { let result = codegen_without_unwrap( " TYPE MyStruct: - STRUCT + STRUCT a : INT; b : INT; END_STRUCT END_TYPE - PROGRAM prg + PROGRAM prg VAR x : MyStruct; END_VAR @@ -92,7 +92,7 @@ fn unknown_struct_field_should_be_reported_with_line_number() { fn invalid_array_access_should_be_reported_with_line_number() { let result = codegen_without_unwrap( " - PROGRAM prg + PROGRAM prg VAR x : INT; END_VAR @@ -114,13 +114,13 @@ fn invalid_array_access_in_struct_should_be_reported_with_line_number() { let result = codegen_without_unwrap( " TYPE MyStruct: - STRUCT + STRUCT a : INT; b : INT; END_STRUCT END_TYPE - PROGRAM prg + PROGRAM prg VAR x : MyStruct; END_VAR @@ -139,7 +139,7 @@ fn invalid_array_access_in_struct_should_be_reported_with_line_number() { #[test] fn invalid_struct_access_in_array_should_be_reported_with_line_number() { let src = " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..1] OF INT; END_VAR @@ -160,7 +160,7 @@ fn invalid_struct_access_in_array_should_be_reported_with_line_number() { #[test] fn invalid_struct_access_in_array_access_should_be_reported_with_line_number() { let src = " - PROGRAM prg + PROGRAM prg VAR x : ARRAY[0..1] OF INT; y : INT; @@ -189,13 +189,13 @@ fn invalid_initial_constant_values_in_pou_variables() { VAR_GLOBAL LEN : DINT := MAX_LEN - 2; END_VAR - + PROGRAM prg - VAR_INPUT + VAR_INPUT my_len: INT := LEN + 4; //cannot be evaluated at compile time! END_VAR END_PROGRAM - + "#, crate::DebugLevel::None, ) @@ -227,12 +227,12 @@ fn assigning_string_literal_to_int_variable_results_in_casting_error() { // WHEN codegen let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : INT; - END_VAR - x := 'A'; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : INT; + END_VAR + x := 'A'; + END_PROGRAM"#, ); // THEN result shoud be a casting error if let Err(msg) = result { @@ -248,12 +248,12 @@ fn assigning_empty_string_literal_to_char_results_in_error() { // WHEN codegen let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : CHAR; - END_VAR - x := ''; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : CHAR; + END_VAR + x := ''; + END_PROGRAM"#, ); // THEN result shoud be an error if let Err(msg) = result { @@ -269,12 +269,12 @@ fn assigning_empty_string_literal_to_wide_char_results_in_error() { // WHEN codegen let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : WCHAR; - END_VAR - x := ""; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : WCHAR; + END_VAR + x := ""; + END_PROGRAM"#, ); // THEN result shoud be an error if let Err(msg) = result { @@ -288,14 +288,14 @@ fn assigning_empty_string_literal_to_wide_char_results_in_error() { fn pointer_binary_expression_adding_two_pointers() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : INT; - ptr : REF_TO INT; - END_VAR - ptr := &(x); - ptr := ptr + ptr; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : INT; + ptr : REF_TO INT; + END_VAR + ptr := &(x); + ptr := ptr + ptr; + END_PROGRAM"#, ); if let Err(msg) = result { assert_snapshot!(msg) @@ -308,14 +308,14 @@ fn pointer_binary_expression_adding_two_pointers() { fn pointer_binary_expression_multiplication() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : INT; - ptr : REF_TO INT; - END_VAR - ptr := &(x); - ptr := ptr * ptr; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : INT; + ptr : REF_TO INT; + END_VAR + ptr := &(x); + ptr := ptr * ptr; + END_PROGRAM"#, ); if let Err(msg) = result { assert_snapshot!(msg) @@ -328,14 +328,14 @@ fn pointer_binary_expression_multiplication() { fn pointer_binary_expression_division() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : INT; - ptr : REF_TO INT; - END_VAR - ptr := &(x); - ptr := ptr / ptr; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : INT; + ptr : REF_TO INT; + END_VAR + ptr := &(x); + ptr := ptr / ptr; + END_PROGRAM"#, ); if let Err(msg) = result { assert_snapshot!(msg) @@ -348,14 +348,14 @@ fn pointer_binary_expression_division() { fn pointer_binary_expression_modulo() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - x : INT; - ptr : REF_TO INT; - END_VAR - ptr := &(x); - ptr := ptr MOD ptr; - END_PROGRAM"#, + PROGRAM mainProg + VAR + x : INT; + ptr : REF_TO INT; + END_VAR + ptr := &(x); + ptr := ptr MOD ptr; + END_PROGRAM"#, ); if let Err(msg) = result { assert_snapshot!(msg) @@ -373,7 +373,7 @@ fn assigning_to_rvalue() { x : INT; END_VAR END_FUNCTION - + PROGRAM main func(1 := 1); END_PROGRAM diff --git a/src/codegen/tests/compare_instructions_tests.rs b/src/codegen/tests/compare_instructions_tests.rs index 0c63a53c0b..1e9cdba24c 100644 --- a/src/codegen/tests/compare_instructions_tests.rs +++ b/src/codegen/tests/compare_instructions_tests.rs @@ -211,24 +211,24 @@ fn pointer_compare_instructions() { // codegen should be successful for binary expression for pointer<->int / int<->pointer / pointer<->pointer let result = codegen( " - PROGRAM main - VAR - x : INT := 10; - y : INT := 20; - pt : REF_TO INT; - comp : BOOL; - END_VAR - pt := &(x); - - (* compare pointer-pointer / pointer-int *) - comp := pt = pt; - comp := pt <> y; - comp := pt < pt; - comp := pt > y; - comp := pt <= pt; - comp := y >= pt; - END_PROGRAM - ", + PROGRAM main + VAR + x : INT := 10; + y : INT := 20; + pt : REF_TO INT; + comp : BOOL; + END_VAR + pt := &(x); + + (* compare pointer-pointer / pointer-int *) + comp := pt = pt; + comp := pt <> y; + comp := pt < pt; + comp := pt > y; + comp := pt <= pt; + comp := y >= pt; + END_PROGRAM + ", ); insta::assert_snapshot!(result); } @@ -241,23 +241,23 @@ fn pointer_function_call_compare_instructions() { FUNCTION foo : LINT END_FUNCTION - PROGRAM main - VAR - pt : REF_TO INT; + PROGRAM main + VAR + pt : REF_TO INT; x : INT; - comp : BOOL; - END_VAR - pt := &(x); - - (* compare pointer-pointer / pointer-int *) - comp := pt = foo(); - comp := pt <> foo(); - comp := pt < foo(); - comp := pt > foo(); - comp := pt <= foo(); - comp := pt >= foo(); - END_PROGRAM - ", + comp : BOOL; + END_VAR + pt := &(x); + + (* compare pointer-pointer / pointer-int *) + comp := pt = foo(); + comp := pt <> foo(); + comp := pt < foo(); + comp := pt > foo(); + comp := pt <= foo(); + comp := pt >= foo(); + END_PROGRAM + ", ); insta::assert_snapshot!(result); } @@ -266,56 +266,56 @@ fn pointer_function_call_compare_instructions() { fn compare_instructions_with_different_types() { let result = codegen( " - TYPE MySubRangeInt: INT(0..500); END_TYPE - TYPE MyDint: DINT; END_TYPE + TYPE MySubRangeInt: INT(0..500); END_TYPE + TYPE MyDint: DINT; END_TYPE FUNCTION foo : LINT END_FUNCTION - PROGRAM main - VAR - ptr_int : REF_TO INT; + PROGRAM main + VAR + ptr_int : REF_TO INT; - a : MySubRangeInt; - b : MyDint; + a : MySubRangeInt; + b : MyDint; - var_sint : SINT; + var_sint : SINT; var_int : INT; - var_dint : DINT; - var_lint : LINT; - - var_usint : USINT; + var_dint : DINT; + var_lint : LINT; + + var_usint : USINT; var_uint : UINT; - var_udint : UDINT; - var_ulint : ULINT; - END_VAR - ptr_int := &(var_int); - - var_sint = var_dint; - var_int < 30; - 10 > var_lint; - - var_usint <> var_udint; - var_uint <= UDINT#40; - UDINT#10 >= var_ulint; - - var_sint = var_usint; - var_uint <= var_lint; - var_dint >= var_ulint; - - var_lint < a; - a > var_sint; - b < var_lint; - SINT#5 <> b; - - ptr_int <= var_usint; - a = ptr_int; - - foo() <> 40; - var_udint <= foo(); - foo() = var_lint; - END_PROGRAM - ", + var_udint : UDINT; + var_ulint : ULINT; + END_VAR + ptr_int := &(var_int); + + var_sint = var_dint; + var_int < 30; + 10 > var_lint; + + var_usint <> var_udint; + var_uint <= UDINT#40; + UDINT#10 >= var_ulint; + + var_sint = var_usint; + var_uint <= var_lint; + var_dint >= var_ulint; + + var_lint < a; + a > var_sint; + b < var_lint; + SINT#5 <> b; + + ptr_int <= var_usint; + a = ptr_int; + + foo() <> 40; + var_udint <= foo(); + foo() = var_lint; + END_PROGRAM + ", ); insta::assert_snapshot!(result); } diff --git a/src/codegen/tests/constants_tests.rs b/src/codegen/tests/constants_tests.rs index e7f827f168..18e2012eeb 100644 --- a/src/codegen/tests/constants_tests.rs +++ b/src/codegen/tests/constants_tests.rs @@ -6,15 +6,15 @@ fn assigning_const_string_variable() { let result = codegen( r#" PROGRAM main - VAR - str : STRING; - END_VAR - str := const_str; - END_PROGRAM + VAR + str : STRING; + END_VAR + str := const_str; + END_PROGRAM - VAR_GLOBAL CONSTANT - const_str : STRING := 'global constant string'; - END_VAR + VAR_GLOBAL CONSTANT + const_str : STRING := 'global constant string'; + END_VAR "#, ); // THEN we expect a memcopy for the assignment @@ -27,15 +27,15 @@ fn assigning_const_array_variable() { let result = codegen( r#" PROGRAM main - VAR - arr : ARRAY[0..3] OF INT; - END_VAR - arr := const_arr; - END_PROGRAM + VAR + arr : ARRAY[0..3] OF INT; + END_VAR + arr := const_arr; + END_PROGRAM - VAR_GLOBAL CONSTANT - const_arr : ARRAY[0..3] OF INT := (1,2,3,4); - END_VAR + VAR_GLOBAL CONSTANT + const_arr : ARRAY[0..3] OF INT := (1,2,3,4); + END_VAR "#, ); // THEN we expect a memcopy for the assignment @@ -48,21 +48,21 @@ fn assigning_const_struct_variable() { let result = codegen( r#" TYPE Point : - STRUCT - x,y : INT; - END_STRUCT + STRUCT + x,y : INT; + END_STRUCT END_TYPE PROGRAM main - VAR - strct : Point; - END_VAR - strct := const_strct; - END_PROGRAM + VAR + strct : Point; + END_VAR + strct := const_strct; + END_PROGRAM - VAR_GLOBAL CONSTANT - const_strct : Point := (x := 1, y := 2); - END_VAR + VAR_GLOBAL CONSTANT + const_strct : Point := (x := 1, y := 2); + END_VAR "#, ); // THEN we expect a memcopy for the assignment diff --git a/src/codegen/tests/debug_tests.rs b/src/codegen/tests/debug_tests.rs index 111fd1257f..8d67b0e472 100644 --- a/src/codegen/tests/debug_tests.rs +++ b/src/codegen/tests/debug_tests.rs @@ -61,8 +61,8 @@ fn test_global_var_float_added_to_debug_info() { let codegen = codegen( r#" VAR_GLOBAL - a : REAL; - b : LREAL; + a : REAL; + b : LREAL; END_VAR "#, ); @@ -75,9 +75,9 @@ fn test_global_var_array_added_to_debug_info() { let codegen = codegen( r#" VAR_GLOBAL - a : ARRAY[0..10] OF DINT; - b : ARRAY[0..10, 11..20] OF DINT; - c : ARRAY[0..10] OF ARRAY[11..20] OF DINT; + a : ARRAY[0..10] OF DINT; + b : ARRAY[0..10, 11..20] OF DINT; + c : ARRAY[0..10] OF ARRAY[11..20] OF DINT; END_VAR "#, ); @@ -89,8 +89,8 @@ fn test_global_var_pointer_added_to_debug_info() { let codegen = codegen( r#" VAR_GLOBAL - a : REF_TO DINT; - b : REF_TO ARRAY[0..10] DINT; + a : REF_TO DINT; + b : REF_TO ARRAY[0..10] DINT; END_VAR "#, ); diff --git a/src/codegen/tests/debug_tests/expression_debugging.rs b/src/codegen/tests/debug_tests/expression_debugging.rs index d6494b5dd9..14a7e9b5ce 100644 --- a/src/codegen/tests/debug_tests/expression_debugging.rs +++ b/src/codegen/tests/debug_tests/expression_debugging.rs @@ -227,7 +227,7 @@ fn if_conditions_location_marked() { myFunc := 1; ELSIF FALSE THEN myFunc := 1; - ELSE + ELSE myFunc := 1; END_IF myFunc := 1; @@ -249,7 +249,7 @@ fn case_conditions_location_marked() { myFunc := 1; 2: myFunc := 1; - ELSE + ELSE myFunc := 1; END_CASE myFunc := 1; diff --git a/src/codegen/tests/expression_tests.rs b/src/codegen/tests/expression_tests.rs index e56c93fd81..d02831c8ae 100644 --- a/src/codegen/tests/expression_tests.rs +++ b/src/codegen/tests/expression_tests.rs @@ -50,7 +50,7 @@ fn calling_strings_in_function_return() { FUNCTION func : STRING func := 'hello'; END_FUNCTION - + PROGRAM main VAR x : STRING; @@ -102,9 +102,9 @@ fn cast_pointer_to_lword() { let result = codegen( r#" FUNCTION baz : INT - VAR - ptr_x : POINTER TO INT; - y : LWORD; + VAR + ptr_x : POINTER TO INT; + y : LWORD; END_VAR; y := ptr_x; @@ -121,8 +121,8 @@ fn cast_lword_to_pointer() { let result = codegen( r#" FUNCTION baz : INT - VAR - ptr_x : POINTER TO INT; + VAR + ptr_x : POINTER TO INT; y : LWORD; END_VAR; @@ -140,8 +140,8 @@ fn cast_between_pointer_types() { let result = codegen( r#" PROGRAM baz - VAR - ptr_x : POINTER TO BYTE; + VAR + ptr_x : POINTER TO BYTE; y : WORD; END_VAR; @@ -159,10 +159,10 @@ fn unnecessary_casts_between_pointer_types() { let result = codegen( r#" TYPE MyByte : BYTE; END_TYPE - + PROGRAM baz - VAR - ptr : POINTER TO BYTE; + VAR + ptr : POINTER TO BYTE; b : BYTE; si : SINT; mb : MyByte; @@ -184,11 +184,11 @@ fn access_string_via_byte_array() { let result = codegen( r#" TYPE MyByte : BYTE; END_TYPE - + PROGRAM baz - VAR + VAR str: STRING[10]; - ptr : POINTER TO BYTE; + ptr : POINTER TO BYTE; bytes : POINTER TO ARRAY[0..9] OF BYTE; END_VAR; @@ -207,26 +207,26 @@ fn pointer_arithmetics() { // codegen should be successful for binary expression for pointer<->int / int<->pointer / pointer<->pointer let result = codegen( " - PROGRAM main - VAR - x : INT := 10; - y : INT := 20; - pt : REF_TO INT; - END_VAR - pt := &(x); - - (* +/- *) - pt := pt + 1; - pt := pt + 1 + 1; - pt := 1 + pt; - pt := pt - y; - pt := 1 + pt + 1; - pt := pt - y - 1; - pt := 1 + 1 + pt ; - pt := y + pt - y ; - pt := y + y + pt ; - END_PROGRAM - ", + PROGRAM main + VAR + x : INT := 10; + y : INT := 20; + pt : REF_TO INT; + END_VAR + pt := &(x); + + (* +/- *) + pt := pt + 1; + pt := pt + 1 + 1; + pt := 1 + pt; + pt := pt - y; + pt := 1 + pt + 1; + pt := pt - y - 1; + pt := 1 + 1 + pt ; + pt := y + pt - y ; + pt := y + y + pt ; + END_PROGRAM + ", ); insta::assert_snapshot!(result); } @@ -239,17 +239,17 @@ fn pointer_arithmetics_function_call() { FUNCTION foo : LINT END_FUNCTION - PROGRAM main - VAR - pt : REF_TO INT; + PROGRAM main + VAR + pt : REF_TO INT; x : INT; - END_VAR - pt := &(x); + END_VAR + pt := &(x); - (* +/- *) - pt := pt + foo(); - END_PROGRAM - ", + (* +/- *) + pt := pt + foo(); + END_PROGRAM + ", ); insta::assert_snapshot!(result); } @@ -265,10 +265,10 @@ fn nested_call_statements() { END_VAR END_FUNCTION - PROGRAM main + PROGRAM main foo(foo(2)); - END_PROGRAM - ", + END_PROGRAM + ", ); // WHEN compiled // WE expect a flat sequence of calls, no regions and branching @@ -280,14 +280,14 @@ fn builtin_function_call_adr() { // GIVEN some nested call statements let result = codegen( " - PROGRAM main + PROGRAM main VAR a : REF_TO DINT; b : DINT; END_VAR a := ADR(b); - END_PROGRAM - ", + END_PROGRAM + ", ); // WHEN compiled // We expect a direct conversion to lword and subsequent assignment (no call) @@ -299,14 +299,14 @@ fn builtin_function_call_ref() { // GIVEN some nested call statements let result = codegen( " - PROGRAM main + PROGRAM main VAR a : REF_TO DINT; b : DINT; END_VAR a := REF(b); - END_PROGRAM - ", + END_PROGRAM + ", ); // WHEN compiled // We expect a direct conversion and subsequent assignment to pointer(no call) @@ -394,7 +394,7 @@ fn builtin_function_call_lower_bound() { END_VAR b := foo(a); END_PROGRAM - + FUNCTION foo : DINT VAR_IN_OUT vla: ARRAY[*] OF DINT; @@ -418,7 +418,7 @@ fn builtin_function_call_upper_bound() { END_VAR b := foo(a); END_PROGRAM - + FUNCTION foo : DINT VAR_IN_OUT vla: ARRAY[*] OF DINT; @@ -446,13 +446,13 @@ fn builtin_function_call_upper_bound_expr() { END_VAR b := foo(a); END_PROGRAM - + FUNCTION foo : DINT VAR_IN_OUT vla: ARRAY[*] OF DINT; END_VAR // upper bound of 4th dimension => 8th element in dimension array - foo := UPPER_BOUND(vla, MY_CONST - (2 * 3)); + foo := UPPER_BOUND(vla, MY_CONST - (2 * 3)); END_VAR END_FUNCTION ", @@ -469,7 +469,7 @@ fn test_max_int() { FUNCTION MAX : U VAR_INPUT in : {sized} U...; END_VAR END_FUNCTION - + FUNCTION main : INT main := MAX(INT#5,INT#2,INT#1,INT#3,INT#4,INT#7,INT#-1); END_FUNCTION", @@ -486,17 +486,17 @@ fn compare_date_time_literals() { VAR_TEMP cmp1, cmp2, cmp3, cmp4, cmp5, cmp6, cmp7, cmp8 : BOOL; END_VAR - cmp1 := TIME#2d4h6m8s10ms11us300ns < TIME#1d8h43m23s55ms; - cmp2 := LTIME#2d4h6m8s10ms11us300ns > LTIME#1d8h43m23s55ms; + cmp1 := TIME#2d4h6m8s10ms11us300ns < TIME#1d8h43m23s55ms; + cmp2 := LTIME#2d4h6m8s10ms11us300ns > LTIME#1d8h43m23s55ms; - cmp3 := TOD#23:59:59.999 < TOD#10:32:59; - cmp4 := LTOD#23:59:59.999 > LTOD#10:32:59; + cmp3 := TOD#23:59:59.999 < TOD#10:32:59; + cmp4 := LTOD#23:59:59.999 > LTOD#10:32:59; - cmp5 := DATE#2022-10-20 < DATE#1999-01-01; - cmp6 := LDATE#2022-10-20 > LDATE#1999-01-01; + cmp5 := DATE#2022-10-20 < DATE#1999-01-01; + cmp6 := LDATE#2022-10-20 > LDATE#1999-01-01; - cmp7 := DT#2022-10-20-23:59:59.999 < DT#1999-01-01-10:32; - cmp8 := LDT#2022-10-20-23:59:59.999 > LDT#1999-01-01-10:32; + cmp7 := DT#2022-10-20-23:59:59.999 < DT#1999-01-01-10:32; + cmp8 := LDT#2022-10-20-23:59:59.999 > LDT#1999-01-01-10:32; END_PROGRAM ", ); diff --git a/src/codegen/tests/function_tests.rs b/src/codegen/tests/function_tests.rs index 32831c5add..a01d117879 100644 --- a/src/codegen/tests/function_tests.rs +++ b/src/codegen/tests/function_tests.rs @@ -62,7 +62,7 @@ fn member_variables_in_body() { VAR_OUTPUT o : LINT; END_VAR VAR v : INT := 1; END_VAR VAR_TEMP vt : INT := 2; END_VAR - + func := i * io - o + v * vt; END_FUNCTION "#, @@ -170,7 +170,7 @@ fn autocast_argument_literals_for_function_call() { PROGRAM main // Check if up- and downcasting works; the IR should not need additional instructions other // than a `alloca` and `store` instruction for their actual types, i.e. no casting needed - func(DINT#1, DINT#2, SINT#3, DINT#4, LREAL#5.0, REAL#6.0); + func(DINT#1, DINT#2, SINT#3, DINT#4, LREAL#5.0, REAL#6.0); END_PROGRAM "#, ); @@ -198,7 +198,7 @@ fn bitcast_argument_references_for_function_call() { in_out : LINT; END_VAR END_FUNCTION - + FUNCTION fn_real : LINT VAR_INPUT {ref} in_ref : REAL; @@ -207,7 +207,7 @@ fn bitcast_argument_references_for_function_call() { in_out : REAL; END_VAR END_FUNCTION - + FUNCTION fn_lreal : LINT VAR_INPUT {ref} in_ref : LREAL; @@ -216,7 +216,7 @@ fn bitcast_argument_references_for_function_call() { in_out : LREAL; END_VAR END_FUNCTION - + PROGRAM main VAR var1_sint, var2_sint : SINT := 1; @@ -232,7 +232,7 @@ fn bitcast_argument_references_for_function_call() { fn_sint(var1_int, var2_int); fn_sint(var1_dint, var2_dint); fn_sint(var1_lint, var2_lint); - + fn_lint(var1_sint, var2_sint); fn_lint(var1_int, var2_int); fn_lint(var1_dint, var2_dint); @@ -284,7 +284,7 @@ fn function_with_varargs_called_in_program() { END_VAR END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -307,7 +307,7 @@ fn function_with_sized_varargs_called_in_program() { END_VAR END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR @@ -333,7 +333,7 @@ fn function_with_ref_sized_string_varargs_called_in_program() { END_VAR END_FUNCTION - PROGRAM prg + PROGRAM prg VAR x : DINT; END_VAR diff --git a/src/codegen/tests/generics_test.rs b/src/codegen/tests/generics_test.rs index 846b210d27..dde712dc0a 100644 --- a/src/codegen/tests/generics_test.rs +++ b/src/codegen/tests/generics_test.rs @@ -18,7 +18,7 @@ fn generic_function_call_generates_real_type_call() { @EXTERNAL FUNCTION MAX : T VAR_INPUT in1, in2 : T END_VAR END_FUNCTION FUNCTION MAX__DINT : DINT VAR_INPUT in1, in2 : DINT END_VAR END_FUNCTION - PROGRAM prg + PROGRAM prg VAR a, b : INT; END_VAR @@ -36,7 +36,7 @@ fn generic_function_call_generates_real_type_call() { fn generic_output_parameter() { // GIVEN ... (see comments in st-code) let src = r" - // ... a generic function FOO with a T, defined by a VAR_OUT + // ... a generic function FOO with a T, defined by a VAR_OUT // parameter (which will be interally treated as a pointer) FUNCTION foo : T VAR_INPUT in1 : DATE; END_VAR @@ -51,8 +51,8 @@ fn generic_output_parameter() { // ... AND a program calling foo with an INT-parameter PROGRAM prg - VAR - theInt, iResult : INT; + VAR + theInt, iResult : INT; data : DATE; END_VAR @@ -67,14 +67,14 @@ fn generic_output_parameter() { #[test] fn generic_call_gets_cast_to_biggest_type() { let src = r" - + {external} FUNCTION MAX : T VAR_INPUT args : {sized} T...; END_VAR END_FUNCTION - + FUNCTION main : LREAL main := MAX(SINT#5,DINT#1,LREAL#1.5,1.2); END_FUNCTION"; @@ -86,38 +86,38 @@ fn generic_call_gets_cast_to_biggest_type() { #[test] fn any_real_function_called_with_ints() { let src = r" - FUNCTION foo : T - VAR_INPUT in1 : T; END_VAR - END_FUNCTION - - FUNCTION foo__REAL : REAL - VAR_INPUT in1 : REAL; END_VAR - END_FUNCTION - - PROGRAM prg - VAR - res_sint : REAL; - res_int : REAL; - res_dint : REAL; - res_lint : LREAL; - res_usint : REAL; - res_uint : REAL; - res_udint : REAL; - res_ulint : LREAL; - END_VAR - VAR_TEMP - v_dint : DINT := 1; - v_udint : DINT := 1; - END_VAR - res_sint := foo(SINT#1); - res_int := foo(INT#1); - res_dint := foo(v_dint); - res_lint := foo(LINT#1); - res_usint := foo(USINT#1); - res_uint := foo(UINT#1); - res_udint := foo(v_udint); - res_ulint := foo(ULINT#1); - END_PROGRAM"; + FUNCTION foo : T + VAR_INPUT in1 : T; END_VAR + END_FUNCTION + + FUNCTION foo__REAL : REAL + VAR_INPUT in1 : REAL; END_VAR + END_FUNCTION + + PROGRAM prg + VAR + res_sint : REAL; + res_int : REAL; + res_dint : REAL; + res_lint : LREAL; + res_usint : REAL; + res_uint : REAL; + res_udint : REAL; + res_ulint : LREAL; + END_VAR + VAR_TEMP + v_dint : DINT := 1; + v_udint : DINT := 1; + END_VAR + res_sint := foo(SINT#1); + res_int := foo(INT#1); + res_dint := foo(v_dint); + res_lint := foo(LINT#1); + res_usint := foo(USINT#1); + res_uint := foo(UINT#1); + res_udint := foo(v_udint); + res_ulint := foo(ULINT#1); + END_PROGRAM"; //Expecting to REAL/LREAL conversion for every call insta::assert_snapshot!(codegen(src)); } diff --git a/src/codegen/tests/initialization_test/global_initializers.rs b/src/codegen/tests/initialization_test/global_initializers.rs index e8694382da..d534b130b4 100644 --- a/src/codegen/tests/initialization_test/global_initializers.rs +++ b/src/codegen/tests/initialization_test/global_initializers.rs @@ -7,7 +7,7 @@ fn initial_values_in_global_constant_variables() { VAR_GLOBAL CONSTANT c_INT : INT := 7; c_3c : INT := 3 * c_INT; - + c_BOOL : BOOL := TRUE; c_not : BOOL := NOT c_BOOL; c_str : STRING[10] := 'Hello'; @@ -60,17 +60,17 @@ fn initial_values_in_global_variables_out_of_order() { VAR_GLOBAL x : MyFB; END_VAR - + PROGRAM prg VAR - x : MyFB; + x : MyFB; END_VAR END_PROGRAM //if this fb is moved to the top, the initializer works FUNCTION_BLOCK MyFB VAR - x : INT := 77; + x : INT := 77; END_VAR END_FUNCTION_BLOCK ", @@ -83,8 +83,8 @@ fn initial_values_in_global_variables_out_of_order() { fn uninitialized_global_array() { let result = codegen( " - VAR_GLOBAL - a : ARRAY[0..1] OF BYTE; + VAR_GLOBAL + a : ARRAY[0..1] OF BYTE; END_VAR ", ); @@ -99,19 +99,19 @@ fn global_constant_without_initializer_gets_default_initializer() { " FUNCTION main : DINT VAR CONSTANT - cmd1 : commands; - myStr1 : STRING; - myArr1 : MyArr; + cmd1 : commands; + myStr1 : STRING; + myArr1 : MyArr; END_VAR VAR_TEMP CONSTANT - cmd2 : commands; - //myStr2 : MyStr; - myArr2 : MyArr; + cmd2 : commands; + //myStr2 : MyStr; + myArr2 : MyArr; END_VAR END_FUNCTION TYPE MyArr: ARRAY[0..3] OF INT; END_TYPE - + TYPE commands : STRUCT ReInit : BOOL; @@ -132,11 +132,11 @@ fn global_constant_without_initializer_gets_declared_initializer() { " FUNCTION main : DINT VAR CONSTANT - cmd1 : commands; + cmd1 : commands; var1 : INT; END_VAR VAR CONSTANT - cmd2 : commands; + cmd2 : commands; var2 : INT; END_VAR END_FUNCTION diff --git a/src/codegen/tests/initialization_test/pou_initializers.rs b/src/codegen/tests/initialization_test/pou_initializers.rs index 8f40458d26..c21e63100c 100644 --- a/src/codegen/tests/initialization_test/pou_initializers.rs +++ b/src/codegen/tests/initialization_test/pou_initializers.rs @@ -9,14 +9,14 @@ fn initial_constant_values_in_pou_variables() { MIN_LEN : INT := 10; LEN : INT := MIN_LEN + 10; END_VAR - + PROGRAM prg - VAR_INPUT + VAR_INPUT my_len: INT := LEN + 4; my_size: INT := MAX_LEN - MIN_LEN; END_VAR END_PROGRAM - + "#, ); @@ -72,8 +72,8 @@ fn initial_values_in_function_block_pou() { fn initial_values_in_array_of_array_variable() { let result = codegen( " - VAR_GLOBAL - a : ARRAY[0..1] OF ARRAY[0..1] OF BYTE := [[1,2],[3,4]]; + VAR_GLOBAL + a : ARRAY[0..1] OF ARRAY[0..1] OF BYTE := [[1,2],[3,4]]; END_VAR ", ); @@ -85,15 +85,15 @@ fn initial_values_in_array_of_array_variable() { fn default_values_for_not_initialized_function_vars() { let result = codegen( " - FUNCTION func : INT - VAR - int_var : INT; - arr_var : ARRAY[-1..2] OF DINT; - ptr_var : REF_TO DINT; - float_var : REAL; - END_VAR - END_FUNCTION - ", + FUNCTION func : INT + VAR + int_var : INT; + arr_var : ARRAY[-1..2] OF DINT; + ptr_var : REF_TO DINT; + float_var : REAL; + END_VAR + END_FUNCTION + ", ); insta::assert_snapshot!(result); } @@ -102,12 +102,12 @@ fn default_values_for_not_initialized_function_vars() { fn initialized_array_in_function() { let result = codegen( " - FUNCTION func : INT - VAR - arr_var : ARRAY[-1..2] OF DINT := [1,2,3,4]; - END_VAR - END_FUNCTION - ", + FUNCTION func : INT + VAR + arr_var : ARRAY[-1..2] OF DINT := [1,2,3,4]; + END_VAR + END_FUNCTION + ", ); insta::assert_snapshot!(result); } @@ -117,12 +117,12 @@ fn initialized_array_type_in_function() { let result = codegen( " TYPE arr : ARRAY[-1..2] OF DINT := [1,2,3,4]; END_TYPE - FUNCTION func : INT - VAR - arr_var : arr; - END_VAR - END_FUNCTION - ", + FUNCTION func : INT + VAR + arr_var : arr; + END_VAR + END_FUNCTION + ", ); insta::assert_snapshot!(result); } @@ -131,12 +131,12 @@ fn initialized_array_type_in_function() { fn memcpy_for_struct_initialization_in_function() { let result = codegen( " - FUNCTION func : INT - VAR - a : STRUCT x : INT := 0; END_STRUCT - END_VAR - END_FUNCTION - ", + FUNCTION func : INT + VAR + a : STRUCT x : INT := 0; END_STRUCT + END_VAR + END_FUNCTION + ", ); insta::assert_snapshot!(result); } @@ -145,12 +145,12 @@ fn memcpy_for_struct_initialization_in_function() { fn no_memcpy_for_struct_initialization_in_program() { let result = codegen( " - PROGRAM prog - VAR - a : STRUCT x : INT := 0; END_STRUCT - END_VAR - END_PROGRAM - ", + PROGRAM prog + VAR + a : STRUCT x : INT := 0; END_STRUCT + END_VAR + END_PROGRAM + ", ); insta::assert_snapshot!(result); } diff --git a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__unresolvable_types_validation.snap b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__unresolvable_types_validation.snap index 23c5f7c70b..7e9aedd6c4 100644 --- a/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__unresolvable_types_validation.snap +++ b/src/codegen/tests/initialization_test/snapshots/rusty__codegen__tests__initialization_test__type_initializers__unresolvable_types_validation.snap @@ -9,8 +9,8 @@ error: Cannot generate literal initializer for 'MyStruct2.b': Value cannot be de │ 7 │ TYPE MyStruct2: STRUCT │ --------- see also -8 │ a : MyStruct := (a:=5, b:=3); -9 │ b : MyStruct := (c:=7); +8 │ a : MyStruct := (a:=5, b:=3); +9 │ b : MyStruct := (c:=7); │ ^^^^ Cannot generate literal initializer for 'MyStruct2.b': Value cannot be derived diff --git a/src/codegen/tests/initialization_test/type_initializers.rs b/src/codegen/tests/initialization_test/type_initializers.rs index beffef7d12..1ee022b89f 100644 --- a/src/codegen/tests/initialization_test/type_initializers.rs +++ b/src/codegen/tests/initialization_test/type_initializers.rs @@ -60,7 +60,7 @@ fn struct_initial_values_different_data_types() { fn initial_values_in_type_alias() { let result = codegen( " - TYPE MyInt: INT := 7; END_TYPE + TYPE MyInt: INT := 7; END_TYPE VAR_GLOBAL x : MyInt; END_VAR ", ); @@ -72,7 +72,7 @@ fn initial_values_in_type_alias() { fn initial_values_in_sub_range_type() { let result = codegen( " - TYPE MyInt: INT(0..1000) := 7; END_TYPE + TYPE MyInt: INT(0..1000) := 7; END_TYPE VAR_GLOBAL x : MyInt; END_VAR ", ); @@ -84,12 +84,12 @@ fn initial_values_in_sub_range_type() { fn expression_list_as_array_initilization() { let result = codegen( " - VAR_GLOBAL - arr : ARRAY[-1..3] OF INT := 1, 2, 3; - b_exp : ARRAY[-1..4] OF DINT := 1+3, 2*3, 7-1, 10; - str : ARRAY[-1..2] OF STRING := 'first', 'second'; - END_VAR - ", + VAR_GLOBAL + arr : ARRAY[-1..3] OF INT := 1, 2, 3; + b_exp : ARRAY[-1..4] OF DINT := 1+3, 2*3, 7-1, 10; + str : ARRAY[-1..2] OF STRING := 'first', 'second'; + END_VAR + ", ); insta::assert_snapshot!(result); } @@ -98,10 +98,10 @@ fn expression_list_as_array_initilization() { fn incomplete_array_initialization() { let result = codegen( " - VAR_GLOBAL - arr : ARRAY[0..5] OF INT := 0, 1, 2; - END_VAR - ", + VAR_GLOBAL + arr : ARRAY[0..5] OF INT := 0, 1, 2; + END_VAR + ", ); insta::assert_snapshot!(result); } @@ -112,10 +112,10 @@ fn incomplete_array_initialization_with_custom_init_value() { " TYPE MyInt : INT := 7; END_TYPE - VAR_GLOBAL - arr : ARRAY[0..5] OF MyInt := 0, 1, 2; - END_VAR - ", + VAR_GLOBAL + arr : ARRAY[0..5] OF MyInt := 0, 1, 2; + END_VAR + ", ); insta::assert_snapshot!(result); } @@ -124,12 +124,12 @@ fn incomplete_array_initialization_with_custom_init_value() { fn alias_chain_with_lots_of_initializers() { let result = codegen( " - TYPE MyInt: MyOtherInt1; END_TYPE - VAR_GLOBAL - x0 : MyInt; - x1 : MyOtherInt1; - x2 : MyOtherInt2; - x3 : MyOtherInt3; + TYPE MyInt: MyOtherInt1; END_TYPE + VAR_GLOBAL + x0 : MyInt; + x1 : MyOtherInt1; + x2 : MyOtherInt2; + x3 : MyOtherInt3; END_VAR TYPE MyOtherInt3 : DINT := 3; END_TYPE TYPE MyOtherInt1 : MyOtherInt2 := 1; END_TYPE @@ -144,15 +144,15 @@ fn alias_chain_with_lots_of_initializers() { fn initial_values_in_single_dimension_array_variable() { let result = codegen( " - VAR_GLOBAL - a : ARRAY[0..2] OF SINT := [1, 2, 3]; - b : ARRAY[0..2] OF INT := [1, 2, 3]; - c : ARRAY[0..2] OF DINT := [1, 2, 3]; - d : ARRAY[0..2] OF LINT := [1, 2, 3]; - e : ARRAY[0..2] OF USINT := [1, 2, 3]; - f : ARRAY[0..2] OF UINT := [1, 2, 3]; - g : ARRAY[0..2] OF ULINT := [1, 2, 3]; - h : ARRAY[0..2] OF BOOL := [TRUE, FALSE, TRUE]; + VAR_GLOBAL + a : ARRAY[0..2] OF SINT := [1, 2, 3]; + b : ARRAY[0..2] OF INT := [1, 2, 3]; + c : ARRAY[0..2] OF DINT := [1, 2, 3]; + d : ARRAY[0..2] OF LINT := [1, 2, 3]; + e : ARRAY[0..2] OF USINT := [1, 2, 3]; + f : ARRAY[0..2] OF UINT := [1, 2, 3]; + g : ARRAY[0..2] OF ULINT := [1, 2, 3]; + h : ARRAY[0..2] OF BOOL := [TRUE, FALSE, TRUE]; END_VAR ", ); @@ -176,8 +176,8 @@ fn initial_values_in_single_dimension_array_type() { fn initial_values_in_multi_dimension_array_variable() { let result = codegen( " - VAR_GLOBAL - a : ARRAY[0..1, 0..1] OF BYTE := [1,2,3,4]; + VAR_GLOBAL + a : ARRAY[0..1, 0..1] OF BYTE := [1,2,3,4]; END_VAR ", ); @@ -189,11 +189,11 @@ fn initial_values_in_multi_dimension_array_variable() { fn initial_values_in_array_variable_using_multiplied_statement() { let result = codegen( " - VAR_GLOBAL - a : ARRAY[0..3] OF BYTE := [4(7)]; - b : ARRAY[0..3] OF BYTE := [2, 2(7), 3]; - c : ARRAY[0..9] OF BYTE := [5(0,1)]; - d : ARRAY[0..9] OF BYTE := [2(2(0), 2(1), 2)]; + VAR_GLOBAL + a : ARRAY[0..3] OF BYTE := [4(7)]; + b : ARRAY[0..3] OF BYTE := [2, 2(7), 3]; + c : ARRAY[0..9] OF BYTE := [5(0,1)]; + d : ARRAY[0..9] OF BYTE := [2(2(0), 2(1), 2)]; END_VAR ", ); @@ -211,9 +211,9 @@ fn initial_values_in_struct_variable() { END_STRUCT END_TYPE - VAR_GLOBAL - a : MyStruct := (a:=3, b:=5); - b : MyStruct := (b:=3, a:=5); + VAR_GLOBAL + a : MyStruct := (a:=3, b:=5); + b : MyStruct := (b:=3, a:=5); END_VAR ", ); @@ -232,9 +232,9 @@ fn initial_values_in_struct_variable_missing_init() { END_STRUCT END_TYPE - VAR_GLOBAL - a : MyStruct := (a:=5, c := 10); - b : MyStruct := (b:=3, c := 10); + VAR_GLOBAL + a : MyStruct := (a:=5, c := 10); + b : MyStruct := (b:=3, c := 10); END_VAR ", ); @@ -246,14 +246,14 @@ fn initial_values_in_struct_variable_missing_init() { fn unresolvable_types_validation() { let msg = codegen_debug_without_unwrap( " - VAR_GLOBAL - a : MyStruct2 := (a := (c:=5, b:= 7), b := (a:=3, b:=2)); - b : MyStruct2 := (b := (a:= 9)); + VAR_GLOBAL + a : MyStruct2 := (a := (c:=5, b:= 7), b := (a:=3, b:=2)); + b : MyStruct2 := (b := (a:= 9)); END_VAR TYPE MyStruct2: STRUCT - a : MyStruct := (a:=5, b:=3); - b : MyStruct := (c:=7); + a : MyStruct := (a:=5, b:=3); + b : MyStruct := (c:=7); END_STRUCT END_TYPE @@ -273,14 +273,14 @@ fn unresolvable_types_validation() { fn initial_nested_struct_delayed_init() { let result = codegen( " - VAR_GLOBAL - a : MyStruct2 := (a := (a:=5, b:= 7), b := (a:=3, b:=2)); - b : MyStruct2 := (b := (a:= 9)); + VAR_GLOBAL + a : MyStruct2 := (a := (a:=5, b:= 7), b := (a:=3, b:=2)); + b : MyStruct2 := (b := (a:= 9)); END_VAR TYPE MyStruct2: STRUCT - a : MyStruct := (a:=5, b:=3); - b : MyStruct := (b:=7); + a : MyStruct := (a:=5, b:=3); + b : MyStruct := (b:=7); END_STRUCT END_TYPE @@ -329,7 +329,7 @@ fn initial_values_in_fb_variable() { END_VAR END_FUNCTION_BLOCK - PROGRAM main + PROGRAM main VAR CONSTANT TEN : INT := 10; @@ -353,7 +353,7 @@ fn complex_initial_values_in_struct_variable_using_multiplied_statement() { y: DINT; END_STRUCT END_TYPE - + TYPE MyStruct: STRUCT point: MyPoint; my_array: ARRAY[0..3] OF INT; @@ -361,12 +361,12 @@ fn complex_initial_values_in_struct_variable_using_multiplied_statement() { END_STRUCT END_TYPE - VAR_GLOBAL + VAR_GLOBAL a : MyStruct := ( point := (x := 1, y:= 2), my_array := [0,1,2,3], f := 7 - ); + ); END_VAR ", ); @@ -382,8 +382,8 @@ fn struct_with_one_field_can_be_initialized() { x: DINT; END_STRUCT END_TYPE - - VAR_GLOBAL + + VAR_GLOBAL a : MyPoint := ( x := 7); END_VAR ", @@ -400,7 +400,7 @@ fn struct_initializer_needs_assignments() { y: DINT; END_STRUCT END_TYPE - + VAR_GLOBAL x : Point := (x := 1, 2); END_VAR @@ -423,7 +423,7 @@ fn struct_initialization_uses_types_default_if_not_provided() { z: MyDINT; END_STRUCT END_TYPE - + VAR_GLOBAL x : Point := (x := 1, y := 2); END_VAR @@ -448,7 +448,7 @@ fn struct_initializer_uses_fallback_to_field_default() { z: DINT := 3; END_STRUCT END_TYPE - + VAR_GLOBAL x : Point := (x := 1); END_VAR @@ -461,26 +461,26 @@ fn struct_initializer_uses_fallback_to_field_default() { #[test] fn array_of_struct_initialization() { let source = " - TYPE myStruct : STRUCT - a, b : DINT; - c : ARRAY[0..1] OF DINT; - END_STRUCT - END_TYPE - - TYPE AliasMyStruct : myStruct; END_TYPE - - VAR_GLOBAL CONSTANT - str : myStruct := (a := 50, b := 60, c := [70, 80]); - alias_str : AliasMyStruct := (a := 50, b := 60, c := [70, 80]); - global_arr : ARRAY[0..1] OF DINT := [30, 40]; - END_VAR - - PROGRAM main - VAR - arr : ARRAY[0..1] OF myStruct := [(a := 10, b := 20, c := [30, 40]), str]; - alias_arr : ARRAY[0..1] OF AliasMyStruct := [(a := 10, b := 20, c := global_arr), alias_str]; - END_VAR - END_PROGRAM + TYPE myStruct : STRUCT + a, b : DINT; + c : ARRAY[0..1] OF DINT; + END_STRUCT + END_TYPE + + TYPE AliasMyStruct : myStruct; END_TYPE + + VAR_GLOBAL CONSTANT + str : myStruct := (a := 50, b := 60, c := [70, 80]); + alias_str : AliasMyStruct := (a := 50, b := 60, c := [70, 80]); + global_arr : ARRAY[0..1] OF DINT := [30, 40]; + END_VAR + + PROGRAM main + VAR + arr : ARRAY[0..1] OF myStruct := [(a := 10, b := 20, c := [30, 40]), str]; + alias_arr : ARRAY[0..1] OF AliasMyStruct := [(a := 10, b := 20, c := global_arr), alias_str]; + END_VAR + END_PROGRAM "; let result = codegen(source); @@ -525,7 +525,7 @@ fn partly_uninitialized_const_struct_will_get_default_values() { z: DINT := 3; END_STRUCT END_TYPE - + VAR_GLOBAL CONSTANT x : Point := (x := 1); empty: Point; @@ -549,7 +549,7 @@ fn partly_uninitialized_const_struct_will_not_report_errors() { z: DINT := 3; END_STRUCT END_TYPE - + VAR_GLOBAL CONSTANT x : Point := (x := 1); empty: Point; @@ -562,7 +562,7 @@ fn partly_uninitialized_const_struct_will_not_report_errors() { #[test] fn enums_with_inline_initializer_do_not_report_errors() { let diagnostics = parse_and_validate( - r#" + r#" VAR_GLOBAL x : (red, yellow, green) := red; END_VAR @@ -585,7 +585,7 @@ fn enums_with_inline_initializer_do_not_report_errors() { #[test] fn enums_with_inline_initializer_are_initialized() { let res = codegen( - r#" + r#" VAR_GLOBAL x : (red, yellow, green) := 2; END_VAR diff --git a/src/codegen/tests/parameters_tests.rs b/src/codegen/tests/parameters_tests.rs index 6d4978e60b..76530faa8b 100644 --- a/src/codegen/tests/parameters_tests.rs +++ b/src/codegen/tests/parameters_tests.rs @@ -5,27 +5,27 @@ fn function_all_parameters_assigned() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(var1, var2, var3); - foo(input1 := var1, output1 => var2, inout1 := var3); - foo(inout1 := var3, input1 := var1, output1 => var2); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(var1, var2, var3); + foo(input1 := var1, output1 => var2, inout1 := var3); + foo(inout1 := var3, input1 := var1, output1 => var2); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -36,25 +36,25 @@ fn function_empty_input_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := , output1 => var2, inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := , output1 => var2, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -65,25 +65,25 @@ fn function_empty_output_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, output1 => , inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, output1 => , inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -94,25 +94,25 @@ fn function_empty_output_default_value_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT := 3; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, output1 => , inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT := 3; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, output1 => , inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -123,25 +123,25 @@ fn function_empty_inout_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, output1 => var2, inout1 := ); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, output1 => var2, inout1 := ); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -152,25 +152,25 @@ fn function_missing_input_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(output1 => var2, inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(output1 => var2, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -181,25 +181,25 @@ fn function_missing_input_default_value_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT := 10; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(output1 => var2, inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT := 10; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(output1 => var2, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -210,25 +210,25 @@ fn function_missing_output_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -239,25 +239,25 @@ fn function_missing_output_default_value_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT := 3; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, inout1 := var3); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT := 3; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -268,25 +268,25 @@ fn function_missing_inout_assignment() { // GIVEN let result = codegen( " - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, output1 => var2); - END_PROGRAM - ", + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, output1 => var2); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -297,28 +297,28 @@ fn function_default_value_parameter_type() { // GIVEN let result = codegen( " - TYPE myType : DINT := 20; END_TYPE - - FUNCTION foo : DINT - VAR_INPUT - input1 : myType; - END_VAR - VAR_OUTPUT - output1 : myType; - output2 : myType; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - foo(output2 => , inout1 := var3); - END_PROGRAM - ", + TYPE myType : DINT := 20; END_TYPE + + FUNCTION foo : DINT + VAR_INPUT + input1 : myType; + END_VAR + VAR_OUTPUT + output1 : myType; + output2 : myType; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + foo(output2 => , inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -329,26 +329,26 @@ fn program_all_parameters_assigned_explicit() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - prog(input1 := var1, output1 => var2, inout1 := var3); - prog(inout1 := var3, input1 := var1, output1 => var2); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + prog(input1 := var1, output1 => var2, inout1 := var3); + prog(inout1 := var3, input1 := var1, output1 => var2); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -359,25 +359,25 @@ fn program_all_parameters_assigned_implicit() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - prog(var1, var2, var3); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + prog(var1, var2, var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -388,25 +388,25 @@ fn program_empty_inout_assignment() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - prog(input1 := var1, output1 => var2, inout1 := ); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + prog(input1 := var1, output1 => var2, inout1 := ); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -417,25 +417,25 @@ fn program_missing_input_assignment() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - prog(output1 => var2, inout1 := var3); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + prog(output1 => var2, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -446,25 +446,25 @@ fn program_missing_output_assignment() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - prog(input1 := var1, inout1 := var3); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + prog(input1 := var1, inout1 := var3); + END_PROGRAM + ", ); // THEN insta::assert_snapshot!(result); @@ -475,17 +475,17 @@ fn program_accepts_empty_statement_as_input_param() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_INPUT - in1: DINT; - in2: DINT; - END_VAR - END_PROGRAM - - PROGRAM main - prog(in1 := 1, in2 := ); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + in1: DINT; + in2: DINT; + END_VAR + END_PROGRAM + + PROGRAM main + prog(in1 := 1, in2 := ); + END_PROGRAM + ", ); // THEN @@ -497,22 +497,22 @@ fn program_accepts_empty_statement_as_output_param() { // GIVEN let result = codegen( " - PROGRAM prog - VAR_OUTPUT - out1 : DINT; - out2 : DINT; - END_VAR - out1 := 1; - out2 := 2; - END_PROGRAM - - PROGRAM main - VAR - x : DINT; - END_VAR - prog( out1 => x, out2 => ); - END_PROGRAM - ", + PROGRAM prog + VAR_OUTPUT + out1 : DINT; + out2 : DINT; + END_VAR + out1 := 1; + out2 := 2; + END_PROGRAM + + PROGRAM main + VAR + x : DINT; + END_VAR + prog( out1 => x, out2 => ); + END_PROGRAM + ", ); // THEN @@ -524,20 +524,20 @@ fn fb_accepts_empty_statement_as_input_param() { // GIVEN let result = codegen( " - FUNCTION_BLOCK fb_t - VAR_INPUT - in1: DINT; - in2: DINT; - END_VAR - END_FUNCTION_BLOCK - - PROGRAM main - VAR - fb : fb_t; - END_VAR - fb(in1 := 1, in2 := ); - END_PROGRAM - ", + FUNCTION_BLOCK fb_t + VAR_INPUT + in1: DINT; + in2: DINT; + END_VAR + END_FUNCTION_BLOCK + + PROGRAM main + VAR + fb : fb_t; + END_VAR + fb(in1 := 1, in2 := ); + END_PROGRAM + ", ); // THEN @@ -549,21 +549,21 @@ fn fb_accepts_empty_statement_as_output_param() { // GIVEN let result = codegen( " - FUNCTION_BLOCK fb_t - VAR_OUTPUT - out1 : DINT; - out2 : DINT; - END_VAR - END_FUNCTION_BLOCK - - PROGRAM main - VAR - fb : fb_t; - x : DINT; - END_VAR - fb( out1 => x, out2 => ); - END_PROGRAM - ", + FUNCTION_BLOCK fb_t + VAR_OUTPUT + out1 : DINT; + out2 : DINT; + END_VAR + END_FUNCTION_BLOCK + + PROGRAM main + VAR + fb : fb_t; + x : DINT; + END_VAR + fb( out1 => x, out2 => ); + END_PROGRAM + ", ); // THEN @@ -575,17 +575,17 @@ fn function_accepts_empty_statement_as_input_param() { // GIVEN let result = codegen( " - FUNCTION foo - VAR_INPUT - in1: DINT; - in2: DINT; - END_VAR - END_FUNCTION - - PROGRAM main - foo(in1 := 1, in2 := ); - END_PROGRAM - ", + FUNCTION foo + VAR_INPUT + in1: DINT; + in2: DINT; + END_VAR + END_FUNCTION + + PROGRAM main + foo(in1 := 1, in2 := ); + END_PROGRAM + ", ); // THEN @@ -597,20 +597,20 @@ fn function_accepts_empty_statement_as_output_param() { // GIVEN let result = codegen( " - FUNCTION foo - VAR_OUTPUT - out1 : DINT; - out2 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - x: DINT; - END_VAR - foo( out1 => x, out2 => ); - END_PROGRAM - ", + FUNCTION foo + VAR_OUTPUT + out1 : DINT; + out2 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + x: DINT; + END_VAR + foo( out1 => x, out2 => ); + END_PROGRAM + ", ); // THEN @@ -622,12 +622,12 @@ fn parameters_behind_function_block_pointer_are_assigned_to() { // GIVEN let result = codegen( " - PROGRAM main + PROGRAM main VAR - file : file_t; + file : file_t; FileOpen : REF_TO file_t; END_VAR - FileOpen := &file; + FileOpen := &file; FileOpen^(var2:=TRUE); END_PROGRAM @@ -637,7 +637,7 @@ fn parameters_behind_function_block_pointer_are_assigned_to() { var2 : BOOL; END_VAR END_FUNCTION_BLOCK - ", + ", ); // THEN @@ -658,19 +658,19 @@ fn var_in_out_params_can_be_out_of_order() { fb.foo(myOtherInOut := out2, myInOut := out1); fb.foo(myInOut := out2, myOtherInOut := out1); END_PROGRAM - + FUNCTION_BLOCK fb_t VAR - myVar : BOOL; + myVar : BOOL; END_VAR VAR_INPUT - myInput : USINT; + myInput : USINT; END_VAR VAR_IN_OUT - myInOut : BOOL; + myInOut : BOOL; END_VAR VAR_OUTPUT - myOut : BOOL; + myOut : BOOL; END_VAR VAR_IN_OUT myOtherInOut : BOOL; diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_char_results_in_error.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_char_results_in_error.snap index b2439583b1..0764b8e51d 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_char_results_in_error.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_char_results_in_error.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: Cannot generate CHAR from empty literal - ┌─ :6:8 + ┌─ :6:14 │ -6 │ x := ''; - │ ^^ Cannot generate CHAR from empty literal +6 │ x := ''; + │ ^^ Cannot generate CHAR from empty literal diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_wide_char_results_in_error.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_wide_char_results_in_error.snap index 1f2cad2e0e..6140be982a 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_wide_char_results_in_error.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_empty_string_literal_to_wide_char_results_in_error.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: Cannot generate WCHAR from empty literal - ┌─ :6:8 + ┌─ :6:14 │ -6 │ x := ""; - │ ^^ Cannot generate WCHAR from empty literal +6 │ x := ""; + │ ^^ Cannot generate WCHAR from empty literal diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_string_literal_to_int_variable_results_in_casting_error.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_string_literal_to_int_variable_results_in_casting_error.snap index 151bfa86ac..ab4fd15945 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_string_literal_to_int_variable_results_in_casting_error.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__assigning_string_literal_to_int_variable_results_in_casting_error.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: Cannot generate String-Literal for type INT - ┌─ :6:8 + ┌─ :6:14 │ -6 │ x := 'A'; - │ ^^^ Cannot generate String-Literal for type INT +6 │ x := 'A'; + │ ^^^ Cannot generate String-Literal for type INT diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_adding_two_pointers.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_adding_two_pointers.snap index 489c31b3a4..617ae6c7fe 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_adding_two_pointers.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_adding_two_pointers.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: '+' operation must contain one int type - ┌─ :8:10 + ┌─ :8:16 │ -8 │ ptr := ptr + ptr; - │ ^^^^^^^^^ '+' operation must contain one int type +8 │ ptr := ptr + ptr; + │ ^^^^^^^^^ '+' operation must contain one int type diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_division.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_division.snap index e339f4ab2f..820b3f4542 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_division.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_division.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: Operator '/' unimplemented for pointers - ┌─ :8:10 + ┌─ :8:16 │ -8 │ ptr := ptr / ptr; - │ ^^^^^^^^^ Operator '/' unimplemented for pointers +8 │ ptr := ptr / ptr; + │ ^^^^^^^^^ Operator '/' unimplemented for pointers diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_modulo.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_modulo.snap index 49ab53f182..46f1c8f69f 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_modulo.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_modulo.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: Operator 'MOD' unimplemented for pointers - ┌─ :8:10 + ┌─ :8:16 │ -8 │ ptr := ptr MOD ptr; - │ ^^^^^^^^^^^ Operator 'MOD' unimplemented for pointers +8 │ ptr := ptr MOD ptr; + │ ^^^^^^^^^^^ Operator 'MOD' unimplemented for pointers diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_multiplication.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_multiplication.snap index 1d1ade8a01..ed4e41f346 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_multiplication.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__codegen_error_messages_tests__pointer_binary_expression_multiplication.snap @@ -3,9 +3,9 @@ source: src/codegen/tests/codegen_error_messages_tests.rs expression: msg --- error: Operator '*' unimplemented for pointers - ┌─ :8:10 + ┌─ :8:16 │ -8 │ ptr := ptr * ptr; - │ ^^^^^^^^^ Operator '*' unimplemented for pointers +8 │ ptr := ptr * ptr; + │ ^^^^^^^^^ Operator '*' unimplemented for pointers diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__generate_with_invalid_casted_string_assignment.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__generate_with_invalid_casted_string_assignment.snap index 70a4b5939b..5971f9e0d2 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__generate_with_invalid_casted_string_assignment.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__generate_with_invalid_casted_string_assignment.snap @@ -5,7 +5,7 @@ expression: result error: Cannot generate String-Literal for type INT ┌─ :5:10 │ -5 │ y := INT#"seven"; +5 │ y := INT#"seven"; │ ^^^^^^^ Cannot generate String-Literal for type INT diff --git a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__nested_struct_initialization_of_multi_dim_string_arrays.snap b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__nested_struct_initialization_of_multi_dim_string_arrays.snap index 8654b75dae..3a44ecd3b0 100644 --- a/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__nested_struct_initialization_of_multi_dim_string_arrays.snap +++ b/src/codegen/tests/snapshots/rusty__codegen__tests__string_tests__nested_struct_initialization_of_multi_dim_string_arrays.snap @@ -7,6 +7,6 @@ source_filename = "main" %CONSTANTS_LANGUAGE = type { i16, i16, [21 x [11 x i8]], [21 x [3 x i8]], [36 x [11 x i8]], [36 x [4 x i8]], [48 x [4 x i8]] } -@x = global %CONSTANTS_LANGUAGE { i16 1, i16 3, [21 x [11 x i8]] [[11 x i8] c"Monday\00\00\00\00\00", [11 x i8] c"Tuesday\00\00\00\00", [11 x i8] c"Wednesday\00\00", [11 x i8] c"Thursday\00\00\00", [11 x i8] c"Friday\00\00\00\00\00", [11 x i8] c"Saturday\00\00\00", [11 x i8] c"Sunday\00\00\00\00\00", [11 x i8] c"Montag\00\00\00\00\00", [11 x i8] c"Dienstag\00\00\00", [11 x i8] c"Mittwoch\00\00\00", [11 x i8] c"Donnerstag\00", [11 x i8] c"Freitag\00\00\00\00", [11 x i8] c"Samstag\00\00\00\00", [11 x i8] c"Sonntag\00\00\00\00", [11 x i8] c"Lundi\00\00\00\00\00\00", [11 x i8] c"Mardi\00\00\00\00\00\00", [11 x i8] c"Mercredi\00\00\00", [11 x i8] c"Jeudi\00\00\00\00\00\00", [11 x i8] c"Vendredi\00\00\00", [11 x i8] c"Samedi\00\00\00\00\00", [11 x i8] c"Dimanche\00\00\00"], [21 x [3 x i8]] [[3 x i8] c"Mo\00", [3 x i8] c"Tu\00", [3 x i8] c"We\00", [3 x i8] c"Th\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"Su\00", [3 x i8] c"Mo\00", [3 x i8] c"Di\00", [3 x i8] c"Mi\00", [3 x i8] c"Do\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"So\00", [3 x i8] c"Lu\00", [3 x i8] c"Ma\00", [3 x i8] c"Me\00", [3 x i8] c"Je\00", [3 x i8] c"Ve\00", [3 x i8] c"Sa\00", [3 x i8] c"Di\00"], [36 x [11 x i8]] [[11 x i8] c"January\00\00\00\00", [11 x i8] c"February\00\00\00", [11 x i8] c"March\00\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"May\00\00\00\00\00\00\00\00", [11 x i8] c"June\00\00\00\00\00\00\00", [11 x i8] c"July\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"October\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"December\00\00\00", [11 x i8] c"Januar\00\00\00\00\00", [11 x i8] c"Februar\00\00\00\00", [11 x i8] c"M\EF\BF\BDrz\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juni\00\00\00\00\00\00\00", [11 x i8] c"Juli\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"Oktober\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"Dezember\00\00\00", [11 x i8] c"Janvier\00\00\00\00", [11 x i8] c"F\EF\BF\BDvrier\00\00", [11 x i8] c"mars\00\00\00\00\00\00\00", [11 x i8] c"Avril\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juin\00\00\00\00\00\00\00", [11 x i8] c"Juillet\00\00\00\00", [11 x i8] c"Ao\EF\BF\BDt\00\00\00\00\00", [11 x i8] c"Septembre\00\00", [11 x i8] c"Octobre\00\00\00\00", [11 x i8] c"Novembre\00\00\00", [11 x i8] c"Decembre\00\00\00"], [36 x [4 x i8]] [[4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mar\00", [4 x i8] c"Apr\00", [4 x i8] c"May\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00", [4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mrz\00", [4 x i8] c"Apr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Okt\00", [4 x i8] c"Nov\00", [4 x i8] c"Dez\00", [4 x i8] c"Jan\00", [4 x i8] c"Fev\00", [4 x i8] c"Mar\00", [4 x i8] c"Avr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aou\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00"], [48 x [4 x i8]] [[4 x i8] c"N\00\00\00", [4 x i8] c"NNE\00", [4 x i8] c"NE\00\00", [4 x i8] c"ENE\00", [4 x i8] c"E\00\00\00", [4 x i8] c"ESE\00", [4 x i8] c"SE\00\00", [4 x i8] c"SSE\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00"] } -@__CONSTANTS_LANGUAGE__init = unnamed_addr constant %CONSTANTS_LANGUAGE { i16 1, i16 3, [21 x [11 x i8]] [[11 x i8] c"Monday\00\00\00\00\00", [11 x i8] c"Tuesday\00\00\00\00", [11 x i8] c"Wednesday\00\00", [11 x i8] c"Thursday\00\00\00", [11 x i8] c"Friday\00\00\00\00\00", [11 x i8] c"Saturday\00\00\00", [11 x i8] c"Sunday\00\00\00\00\00", [11 x i8] c"Montag\00\00\00\00\00", [11 x i8] c"Dienstag\00\00\00", [11 x i8] c"Mittwoch\00\00\00", [11 x i8] c"Donnerstag\00", [11 x i8] c"Freitag\00\00\00\00", [11 x i8] c"Samstag\00\00\00\00", [11 x i8] c"Sonntag\00\00\00\00", [11 x i8] c"Lundi\00\00\00\00\00\00", [11 x i8] c"Mardi\00\00\00\00\00\00", [11 x i8] c"Mercredi\00\00\00", [11 x i8] c"Jeudi\00\00\00\00\00\00", [11 x i8] c"Vendredi\00\00\00", [11 x i8] c"Samedi\00\00\00\00\00", [11 x i8] c"Dimanche\00\00\00"], [21 x [3 x i8]] [[3 x i8] c"Mo\00", [3 x i8] c"Tu\00", [3 x i8] c"We\00", [3 x i8] c"Th\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"Su\00", [3 x i8] c"Mo\00", [3 x i8] c"Di\00", [3 x i8] c"Mi\00", [3 x i8] c"Do\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"So\00", [3 x i8] c"Lu\00", [3 x i8] c"Ma\00", [3 x i8] c"Me\00", [3 x i8] c"Je\00", [3 x i8] c"Ve\00", [3 x i8] c"Sa\00", [3 x i8] c"Di\00"], [36 x [11 x i8]] [[11 x i8] c"January\00\00\00\00", [11 x i8] c"February\00\00\00", [11 x i8] c"March\00\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"May\00\00\00\00\00\00\00\00", [11 x i8] c"June\00\00\00\00\00\00\00", [11 x i8] c"July\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"October\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"December\00\00\00", [11 x i8] c"Januar\00\00\00\00\00", [11 x i8] c"Februar\00\00\00\00", [11 x i8] c"M\EF\BF\BDrz\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juni\00\00\00\00\00\00\00", [11 x i8] c"Juli\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"Oktober\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"Dezember\00\00\00", [11 x i8] c"Janvier\00\00\00\00", [11 x i8] c"F\EF\BF\BDvrier\00\00", [11 x i8] c"mars\00\00\00\00\00\00\00", [11 x i8] c"Avril\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juin\00\00\00\00\00\00\00", [11 x i8] c"Juillet\00\00\00\00", [11 x i8] c"Ao\EF\BF\BDt\00\00\00\00\00", [11 x i8] c"Septembre\00\00", [11 x i8] c"Octobre\00\00\00\00", [11 x i8] c"Novembre\00\00\00", [11 x i8] c"Decembre\00\00\00"], [36 x [4 x i8]] [[4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mar\00", [4 x i8] c"Apr\00", [4 x i8] c"May\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00", [4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mrz\00", [4 x i8] c"Apr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Okt\00", [4 x i8] c"Nov\00", [4 x i8] c"Dez\00", [4 x i8] c"Jan\00", [4 x i8] c"Fev\00", [4 x i8] c"Mar\00", [4 x i8] c"Avr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aou\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00"], [48 x [4 x i8]] [[4 x i8] c"N\00\00\00", [4 x i8] c"NNE\00", [4 x i8] c"NE\00\00", [4 x i8] c"ENE\00", [4 x i8] c"E\00\00\00", [4 x i8] c"ESE\00", [4 x i8] c"SE\00\00", [4 x i8] c"SSE\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00"] } +@x = global %CONSTANTS_LANGUAGE { i16 1, i16 3, [21 x [11 x i8]] [[11 x i8] c"Monday\00\00\00\00\00", [11 x i8] c"Tuesday\00\00\00\00", [11 x i8] c"Wednesday\00\00", [11 x i8] c"Thursday\00\00\00", [11 x i8] c"Friday\00\00\00\00\00", [11 x i8] c"Saturday\00\00\00", [11 x i8] c"Sunday\00\00\00\00\00", [11 x i8] c"Montag\00\00\00\00\00", [11 x i8] c"Dienstag\00\00\00", [11 x i8] c"Mittwoch\00\00\00", [11 x i8] c"Donnerstag\00", [11 x i8] c"Freitag\00\00\00\00", [11 x i8] c"Samstag\00\00\00\00", [11 x i8] c"Sonntag\00\00\00\00", [11 x i8] c"Lundi\00\00\00\00\00\00", [11 x i8] c"Mardi\00\00\00\00\00\00", [11 x i8] c"Mercredi\00\00\00", [11 x i8] c"Jeudi\00\00\00\00\00\00", [11 x i8] c"Vendredi\00\00\00", [11 x i8] c"Samedi\00\00\00\00\00", [11 x i8] c"Dimanche\00\00\00"], [21 x [3 x i8]] [[3 x i8] c"Mo\00", [3 x i8] c"Tu\00", [3 x i8] c"We\00", [3 x i8] c"Th\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"Su\00", [3 x i8] c"Mo\00", [3 x i8] c"Di\00", [3 x i8] c"Mi\00", [3 x i8] c"Do\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"So\00", [3 x i8] c"Lu\00", [3 x i8] c"Ma\00", [3 x i8] c"Me\00", [3 x i8] c"Je\00", [3 x i8] c"Ve\00", [3 x i8] c"Sa\00", [3 x i8] c"Di\00"], [36 x [11 x i8]] [[11 x i8] c"January\00\00\00\00", [11 x i8] c"February\00\00\00", [11 x i8] c"March\00\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"May\00\00\00\00\00\00\00\00", [11 x i8] c"June\00\00\00\00\00\00\00", [11 x i8] c"July\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"October\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"December\00\00\00", [11 x i8] c"Januar\00\00\00\00\00", [11 x i8] c"Februar\00\00\00\00", [11 x i8] c"M\C3\A4rz\00\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juni\00\00\00\00\00\00\00", [11 x i8] c"Juli\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"Oktober\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"Dezember\00\00\00", [11 x i8] c"Janvier\00\00\00\00", [11 x i8] c"F\C3\A9vrier\00\00\00", [11 x i8] c"mars\00\00\00\00\00\00\00", [11 x i8] c"Avril\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juin\00\00\00\00\00\00\00", [11 x i8] c"Juillet\00\00\00\00", [11 x i8] c"Ao\C3\BBt\00\00\00\00\00\00", [11 x i8] c"Septembre\00\00", [11 x i8] c"Octobre\00\00\00\00", [11 x i8] c"Novembre\00\00\00", [11 x i8] c"Decembre\00\00\00"], [36 x [4 x i8]] [[4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mar\00", [4 x i8] c"Apr\00", [4 x i8] c"May\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00", [4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mrz\00", [4 x i8] c"Apr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Okt\00", [4 x i8] c"Nov\00", [4 x i8] c"Dez\00", [4 x i8] c"Jan\00", [4 x i8] c"Fev\00", [4 x i8] c"Mar\00", [4 x i8] c"Avr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aou\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00"], [48 x [4 x i8]] [[4 x i8] c"N\00\00\00", [4 x i8] c"NNE\00", [4 x i8] c"NE\00\00", [4 x i8] c"ENE\00", [4 x i8] c"E\00\00\00", [4 x i8] c"ESE\00", [4 x i8] c"SE\00\00", [4 x i8] c"SSE\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00"] } +@__CONSTANTS_LANGUAGE__init = unnamed_addr constant %CONSTANTS_LANGUAGE { i16 1, i16 3, [21 x [11 x i8]] [[11 x i8] c"Monday\00\00\00\00\00", [11 x i8] c"Tuesday\00\00\00\00", [11 x i8] c"Wednesday\00\00", [11 x i8] c"Thursday\00\00\00", [11 x i8] c"Friday\00\00\00\00\00", [11 x i8] c"Saturday\00\00\00", [11 x i8] c"Sunday\00\00\00\00\00", [11 x i8] c"Montag\00\00\00\00\00", [11 x i8] c"Dienstag\00\00\00", [11 x i8] c"Mittwoch\00\00\00", [11 x i8] c"Donnerstag\00", [11 x i8] c"Freitag\00\00\00\00", [11 x i8] c"Samstag\00\00\00\00", [11 x i8] c"Sonntag\00\00\00\00", [11 x i8] c"Lundi\00\00\00\00\00\00", [11 x i8] c"Mardi\00\00\00\00\00\00", [11 x i8] c"Mercredi\00\00\00", [11 x i8] c"Jeudi\00\00\00\00\00\00", [11 x i8] c"Vendredi\00\00\00", [11 x i8] c"Samedi\00\00\00\00\00", [11 x i8] c"Dimanche\00\00\00"], [21 x [3 x i8]] [[3 x i8] c"Mo\00", [3 x i8] c"Tu\00", [3 x i8] c"We\00", [3 x i8] c"Th\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"Su\00", [3 x i8] c"Mo\00", [3 x i8] c"Di\00", [3 x i8] c"Mi\00", [3 x i8] c"Do\00", [3 x i8] c"Fr\00", [3 x i8] c"Sa\00", [3 x i8] c"So\00", [3 x i8] c"Lu\00", [3 x i8] c"Ma\00", [3 x i8] c"Me\00", [3 x i8] c"Je\00", [3 x i8] c"Ve\00", [3 x i8] c"Sa\00", [3 x i8] c"Di\00"], [36 x [11 x i8]] [[11 x i8] c"January\00\00\00\00", [11 x i8] c"February\00\00\00", [11 x i8] c"March\00\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"May\00\00\00\00\00\00\00\00", [11 x i8] c"June\00\00\00\00\00\00\00", [11 x i8] c"July\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"October\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"December\00\00\00", [11 x i8] c"Januar\00\00\00\00\00", [11 x i8] c"Februar\00\00\00\00", [11 x i8] c"M\C3\A4rz\00\00\00\00\00\00", [11 x i8] c"April\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juni\00\00\00\00\00\00\00", [11 x i8] c"Juli\00\00\00\00\00\00\00", [11 x i8] c"August\00\00\00\00\00", [11 x i8] c"September\00\00", [11 x i8] c"Oktober\00\00\00\00", [11 x i8] c"November\00\00\00", [11 x i8] c"Dezember\00\00\00", [11 x i8] c"Janvier\00\00\00\00", [11 x i8] c"F\C3\A9vrier\00\00\00", [11 x i8] c"mars\00\00\00\00\00\00\00", [11 x i8] c"Avril\00\00\00\00\00\00", [11 x i8] c"Mai\00\00\00\00\00\00\00\00", [11 x i8] c"Juin\00\00\00\00\00\00\00", [11 x i8] c"Juillet\00\00\00\00", [11 x i8] c"Ao\C3\BBt\00\00\00\00\00\00", [11 x i8] c"Septembre\00\00", [11 x i8] c"Octobre\00\00\00\00", [11 x i8] c"Novembre\00\00\00", [11 x i8] c"Decembre\00\00\00"], [36 x [4 x i8]] [[4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mar\00", [4 x i8] c"Apr\00", [4 x i8] c"May\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00", [4 x i8] c"Jan\00", [4 x i8] c"Feb\00", [4 x i8] c"Mrz\00", [4 x i8] c"Apr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aug\00", [4 x i8] c"Sep\00", [4 x i8] c"Okt\00", [4 x i8] c"Nov\00", [4 x i8] c"Dez\00", [4 x i8] c"Jan\00", [4 x i8] c"Fev\00", [4 x i8] c"Mar\00", [4 x i8] c"Avr\00", [4 x i8] c"Mai\00", [4 x i8] c"Jun\00", [4 x i8] c"Jul\00", [4 x i8] c"Aou\00", [4 x i8] c"Sep\00", [4 x i8] c"Oct\00", [4 x i8] c"Nov\00", [4 x i8] c"Dec\00"], [48 x [4 x i8]] [[4 x i8] c"N\00\00\00", [4 x i8] c"NNE\00", [4 x i8] c"NE\00\00", [4 x i8] c"ENE\00", [4 x i8] c"E\00\00\00", [4 x i8] c"ESE\00", [4 x i8] c"SE\00\00", [4 x i8] c"SSE\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00", [4 x i8] c"N\00\00\00", [4 x i8] c"NNO\00", [4 x i8] c"NO\00\00", [4 x i8] c"ONO\00", [4 x i8] c"O\00\00\00", [4 x i8] c"OSO\00", [4 x i8] c"SO\00\00", [4 x i8] c"SSO\00", [4 x i8] c"S\00\00\00", [4 x i8] c"SSW\00", [4 x i8] c"SW\00\00", [4 x i8] c"WSW\00", [4 x i8] c"W\00\00\00", [4 x i8] c"WNW\00", [4 x i8] c"NW\00\00", [4 x i8] c"NNW\00"] } diff --git a/src/codegen/tests/string_tests.rs b/src/codegen/tests/string_tests.rs index e86cc42735..b1361d5a14 100644 --- a/src/codegen/tests/string_tests.rs +++ b/src/codegen/tests/string_tests.rs @@ -13,7 +13,7 @@ PROGRAM prg y : STRING[15]; z : STRING[30] := 'xyz'; END_VAR - + y := z; z := y; END_PROGRAM @@ -58,7 +58,7 @@ PROGRAM prg y : STRING[15]; z : STRING[30] := 'xyz'; END_VAR - + END_PROGRAM ", ); @@ -90,9 +90,9 @@ VAR END_VAR // cast a WSTRING to a STRING -y := STRING#"im a genius"; +y := STRING#"im a genius"; // cast a STRING to a WSTRING -z := WSTRING#'im a utf16 genius'; +z := WSTRING#'im a utf16 genius'; END_PROGRAM "#, ); @@ -106,7 +106,7 @@ fn generate_with_invalid_casted_string_assignment() { VAR y : INT; END_VAR -y := INT#"seven"; +y := INT#"seven"; END_PROGRAM "#, ) @@ -206,10 +206,10 @@ fn variable_length_strings_using_constants_can_be_created() { let result = codegen( r#" VAR_GLOBAL CONSTANT - LONG_STRING : INT := 15; - SHORT_STRING : INT := 3; + LONG_STRING : INT := 15; + SHORT_STRING : INT := 3; END_VAR - + PROGRAM prg VAR y : STRING[LONG_STRING]; @@ -236,19 +236,19 @@ fn nested_struct_initialization_of_multi_dim_string_arrays() { (* Language Setup *) DEFAULT : INT := 1; (* 1=english, 2=german 3=french *) LMAX : INT := 3; - WEEKDAYS : ARRAY[1..3, 1..7] OF STRING[10] := ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', + WEEKDAYS : ARRAY[1..3, 1..7] OF STRING[10] := ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche']; - WEEKDAYS2 : ARRAY[1..3, 1..7] OF STRING[2] := ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su', + WEEKDAYS2 : ARRAY[1..3, 1..7] OF STRING[2] := ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So', 'Lu', 'Ma', 'Me', 'Je', 'Ve', 'Sa', 'Di']; - MONTHS : ARRAY[1..3, 1..12] OF STRING[10] := ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', - 'Januar', 'Februar', 'M�rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember', - 'Janvier', 'F�vrier', 'mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao�t', 'Septembre', 'Octobre', 'Novembre', 'Decembre']; - MONTHS3 : ARRAY[1..3, 1..12] OF STRING[3] := ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', + MONTHS : ARRAY[1..3, 1..12] OF STRING[10] := ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', + 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember', + 'Janvier', 'Février', 'mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Decembre']; + MONTHS3 : ARRAY[1..3, 1..12] OF STRING[3] := ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mrz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez', 'Jan', 'Fev', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aou', 'Sep', 'Oct', 'Nov', 'Dec']; - DIRS : ARRAY[1..3,0..15] OF STRING[3] := ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', + DIRS : ARRAY[1..3,0..15] OF STRING[3] := ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N', 'NNO', 'NO', 'ONO', 'O', 'OSO', 'SO', 'SSO', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW', 'N', 'NNO', 'NO', 'ONO', 'O', 'OSO', 'SO', 'SSO', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']; END_STRUCT @@ -268,7 +268,7 @@ fn string_function_parameters() { VAR_INPUT s : STRING; END_VAR - + RETURN 0; END_PROGRAM @@ -296,21 +296,21 @@ fn program_string_output() { // GIVEN PROGRAM returning strings let result = codegen( r#" - PROGRAM prog - VAR_OUTPUT - output1 : STRING; - output2 : WSTRING; - END_VAR - output1 := 'string'; - output2 := "wstring"; - END_PROGRAM + PROGRAM prog + VAR_OUTPUT + output1 : STRING; + output2 : WSTRING; + END_VAR + output1 := 'string'; + output2 := "wstring"; + END_PROGRAM PROGRAM main - VAR - x : STRING[6]; - y : WSTRING[7]; - END_VAR - prog(x, y); + VAR + x : STRING[6]; + y : WSTRING[7]; + END_VAR + prog(x, y); END_PROGRAM "#, ); diff --git a/src/codegen/tests/switch_case_tests.rs b/src/codegen/tests/switch_case_tests.rs index 86566cf595..8ba6841ca0 100644 --- a/src/codegen/tests/switch_case_tests.rs +++ b/src/codegen/tests/switch_case_tests.rs @@ -25,18 +25,18 @@ For non const variable references we need our own validation tests -> statement_ fn switch_case_duplicate_integer_literal_integer() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - input, res : DINT; - END_VAR - CASE input OF - 2: - res := 1; - 2: - res := 2; - END_CASE - END_PROGRAM - "#, + PROGRAM mainProg + VAR + input, res : DINT; + END_VAR + CASE input OF + 2: + res := 1; + 2: + res := 2; + END_CASE + END_PROGRAM + "#, ); if let Err(msg) = result { assert_eq!( @@ -55,22 +55,22 @@ fn switch_case_duplicate_integer_literal_integer() { fn switch_case_duplicate_integer_literal_integer_and_const() { let result = codegen_without_unwrap( r#" - VAR_GLOBAL CONSTANT - GLOB : DINT := 2; - END_VAR + VAR_GLOBAL CONSTANT + GLOB : DINT := 2; + END_VAR - PROGRAM mainProg - VAR - input, res : DINT; - END_VAR - CASE input OF - 2: - res := 1; - GLOB: - res := 2; - END_CASE - END_PROGRAM - "#, + PROGRAM mainProg + VAR + input, res : DINT; + END_VAR + CASE input OF + 2: + res := 1; + GLOB: + res := 2; + END_CASE + END_PROGRAM + "#, ); if let Err(msg) = result { assert_eq!( @@ -89,18 +89,18 @@ fn switch_case_duplicate_integer_literal_integer_and_const() { fn switch_case_duplicate_integer_literal_integer_and_binary_expression() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - input, res : DINT; - END_VAR - CASE input OF - 2: - res := 1; - 1*2: - res := 2; - END_CASE - END_PROGRAM - "#, + PROGRAM mainProg + VAR + input, res : DINT; + END_VAR + CASE input OF + 2: + res := 1; + 1*2: + res := 2; + END_CASE + END_PROGRAM + "#, ); if let Err(msg) = result { assert_eq!( @@ -119,24 +119,24 @@ fn switch_case_duplicate_integer_literal_integer_and_binary_expression() { fn switch_case_duplicate_integer_const() { let result = codegen_without_unwrap( r#" - VAR_GLOBAL CONSTANT - GLOB : DINT := 2; - END_VAR + VAR_GLOBAL CONSTANT + GLOB : DINT := 2; + END_VAR - TYPE myType: ( BASE := GLOB ); END_TYPE + TYPE myType: ( BASE := GLOB ); END_TYPE - PROGRAM mainProg - VAR - input, res : DINT; - END_VAR - CASE input OF - GLOB: - res := 1; - BASE: - res := 2; - END_CASE - END_PROGRAM - "#, + PROGRAM mainProg + VAR + input, res : DINT; + END_VAR + CASE input OF + GLOB: + res := 1; + BASE: + res := 2; + END_CASE + END_PROGRAM + "#, ); if let Err(msg) = result { assert_eq!( @@ -155,22 +155,22 @@ fn switch_case_duplicate_integer_const() { fn switch_case_duplicate_integer_const_and_binary_expression() { let result = codegen_without_unwrap( r#" - VAR_GLOBAL CONSTANT - GLOB : DINT := 2; - END_VAR + VAR_GLOBAL CONSTANT + GLOB : DINT := 2; + END_VAR - PROGRAM mainProg - VAR - input, res : DINT; - END_VAR - CASE input OF - GLOB: - res := 1; - 1*2: - res := 2; - END_CASE - END_PROGRAM - "#, + PROGRAM mainProg + VAR + input, res : DINT; + END_VAR + CASE input OF + GLOB: + res := 1; + 1*2: + res := 2; + END_CASE + END_PROGRAM + "#, ); if let Err(msg) = result { assert_eq!( @@ -189,18 +189,18 @@ fn switch_case_duplicate_integer_const_and_binary_expression() { fn switch_case_duplicate_integer_binary_expression() { let result = codegen_without_unwrap( r#" - PROGRAM mainProg - VAR - input, res : DINT; - END_VAR - CASE input OF - 1*2: - res := 1; - 1+1: - res := 2; - END_CASE - END_PROGRAM - "#, + PROGRAM mainProg + VAR + input, res : DINT; + END_VAR + CASE input OF + 1*2: + res := 1; + 1+1: + res := 2; + END_CASE + END_PROGRAM + "#, ); if let Err(msg) = result { assert_eq!( diff --git a/src/codegen/tests/typesystem_test.rs b/src/codegen/tests/typesystem_test.rs index 98b2412693..0f3c62f914 100644 --- a/src/codegen/tests/typesystem_test.rs +++ b/src/codegen/tests/typesystem_test.rs @@ -258,7 +258,7 @@ fn int_bigger_than_byte_promoted_on_compare_statement() { #[test] fn numerical_promotion_for_variadic_functions_without_declaration() { let src = r#" - {external} + {external} FUNCTION printf : DINT VAR_IN_OUT format: STRING; @@ -268,7 +268,7 @@ fn numerical_promotion_for_variadic_functions_without_declaration() { END_VAR END_FUNCTION - PROGRAM main + PROGRAM main VAR_TEMP s: STRING := '$N numbers: %f %f %f %d $N $N'; float: REAL := 3.0; @@ -286,7 +286,7 @@ fn numerical_promotion_for_variadic_functions_without_declaration() { #[test] fn small_int_varargs_get_promoted_while_32bit_and_higher_keep_their_type() { let src = r#" - {external} + {external} FUNCTION printf : DINT VAR_IN_OUT format: STRING; diff --git a/src/index.rs b/src/index.rs index a5db5a43a6..a64a5f2a72 100644 --- a/src/index.rs +++ b/src/index.rs @@ -1248,7 +1248,7 @@ impl Index { self.get_const_expressions().maybe_get_constant_statement(id) } - /// returns type aliased by Alias or SubRange + /// returns type aliased by Alias or SubRange fn get_aliased_target_type(&self, dt: &DataTypeInformation) -> Option<&DataType> { match dt { DataTypeInformation::SubRange { referenced_type, .. } diff --git a/src/index/tests/index_tests.rs b/src/index/tests/index_tests.rs index f1cfbdbd96..fdcdc3fa95 100644 --- a/src/index/tests/index_tests.rs +++ b/src/index/tests/index_tests.rs @@ -25,7 +25,7 @@ fn index_not_case_sensitive() { VAR_GLOBAL a: INT; - x : ST; + x : ST; END_VAR FUNCTION foo : INT END_FUNCTION @@ -246,13 +246,13 @@ fn pous_are_indexed() { r#" PROGRAM myProgram END_PROGRAM - + FUNCTION myFunction : INT END_FUNCTION - + FUNCTION_BLOCK myFunctionBlock : INT END_FUNCTION_BLOCK - + CLASS myClass END_CLASS @@ -411,7 +411,7 @@ fn index_can_be_retrieved_from_qualified_name() { fb2_inst : fb2; END_VAR END_FUNCTION_BLOCK - + FUNCTION_BLOCK fb2 VAR_INPUT fb3_inst : fb3; @@ -448,7 +448,7 @@ fn callable_instances_can_be_retreived() { fb2_inst : fb2; END_VAR END_FUNCTION_BLOCK - + FUNCTION_BLOCK fb2 VAR_INPUT fb3_inst : fb3; @@ -779,11 +779,11 @@ fn pre_processing_generates_array_of_array_type() { fn pre_processing_nested_array_in_struct() { let src = r#" TYPE MyStruct: - STRUCT + STRUCT field1 : ARRAY[0..4] OF INT; END_STRUCT END_TYPE - + PROGRAM Main VAR m : MyStruct; @@ -916,8 +916,8 @@ fn pre_processing_generates_nested_generic_types() { fn sub_range_boundaries_are_registered_at_the_index() { // GIVEN a Subrange INT from 7 to 1000 let src = " - TYPE MyInt: INT(7..1000); END_TYPE - TYPE MyAliasInt: MyInt; END_TYPE + TYPE MyInt: INT(7..1000); END_TYPE + TYPE MyAliasInt: MyInt; END_TYPE "; // WHEN the program is indexed let (_, index) = index(src); @@ -1196,8 +1196,8 @@ fn function_name_equals_return_type() { // WHEN the function is indexed let (_, index) = index( " - FUNCTION TIME : TIME - END_FUNCTION", + FUNCTION TIME : TIME + END_FUNCTION", ); // THEN there should be a indexed pou_type @@ -1214,12 +1214,12 @@ fn global_vars_for_structs() { // WHEN the program is indexed let (_, index) = index( " - PROGRAM main - VAR - x : STRUCT var1 : INT; END_STRUCT - END_VAR - END_PROGRAM - ", + PROGRAM main + VAR + x : STRUCT var1 : INT; END_STRUCT + END_VAR + END_PROGRAM + ", ); // THEN there should be a global variable for the struct @@ -1233,15 +1233,15 @@ fn pointer_and_in_out_pointer_should_not_conflict() { // WHEN the program is indexed let (_, index) = index( " - PROGRAM main - VAR_INPUT - x : REF_TO INT; - END_VAR + PROGRAM main + VAR_INPUT + x : REF_TO INT; + END_VAR VAR_IN_OUT y : INT; END_VAR - END_PROGRAM - ", + END_PROGRAM + ", ); // THEN x and y whould be different pointer types @@ -1277,17 +1277,17 @@ fn pointer_and_in_out_pointer_should_not_conflict_2() { let id_provider = IdProvider::default(); let (result, mut index) = index_with_ids( " - PROGRAM main - VAR_INPUT - x : REF_TO INT; - END_VAR + PROGRAM main + VAR_INPUT + x : REF_TO INT; + END_VAR VAR_IN_OUT y : INT; END_VAR &y; //this will add another pointer_to_int type to the index (autoderef = false) - END_PROGRAM - ", + END_PROGRAM + ", id_provider.clone(), ); @@ -1422,18 +1422,18 @@ fn program_parameters_variable_type() { // WHEN the PROGRAM is indexed let (_, index) = index( " - PROGRAM main - VAR_INPUT - input1 : INT; - END_VAR - VAR_OUTPUT - output1 : INT; - END_VAR - VAR_IN_OUT - inout1 : INT; - END_VAR - END_PROGRAM - ", + PROGRAM main + VAR_INPUT + input1 : INT; + END_VAR + VAR_OUTPUT + output1 : INT; + END_VAR + VAR_IN_OUT + inout1 : INT; + END_VAR + END_PROGRAM + ", ); // THEN the parameters should have the correct VariableType @@ -1452,18 +1452,18 @@ fn fb_parameters_variable_type() { // WHEN the FB is indexed let (_, index) = index( " - FUNCTION_BLOCK fb - VAR_INPUT - input1 : INT; - END_VAR - VAR_OUTPUT - output1 : INT; - END_VAR - VAR_IN_OUT - inout1 : INT; - END_VAR - END_FUNCTION_BLOCK - ", + FUNCTION_BLOCK fb + VAR_INPUT + input1 : INT; + END_VAR + VAR_OUTPUT + output1 : INT; + END_VAR + VAR_IN_OUT + inout1 : INT; + END_VAR + END_FUNCTION_BLOCK + ", ); // THEN the parameters should have the correct VariableType @@ -1482,18 +1482,18 @@ fn function_parameters_variable_type() { // WHEN the FUNCTION is indexed let (_, index) = index( " - FUNCTION foo : INT - VAR_INPUT - input1 : INT; - END_VAR - VAR_OUTPUT - output1 : INT; - END_VAR - VAR_IN_OUT - inout1 : INT; - END_VAR - END_FUNCTION - ", + FUNCTION foo : INT + VAR_INPUT + input1 : INT; + END_VAR + VAR_OUTPUT + output1 : INT; + END_VAR + VAR_IN_OUT + inout1 : INT; + END_VAR + END_FUNCTION + ", ); // THEN the parameters should have the correct VariableType @@ -1513,18 +1513,18 @@ fn pou_duplicates_are_indexed() { // WHEN the code is indexed let (_, index) = index( " - PROGRAM foo - VAR_INPUT - input1 : INT; - END_VAR - END_PROGRAM - - PROGRAM foo - VAR_INPUT - input2 : INT; - END_VAR - END_PROGRAM - ", + PROGRAM foo + VAR_INPUT + input1 : INT; + END_VAR + END_PROGRAM + + PROGRAM foo + VAR_INPUT + input2 : INT; + END_VAR + END_PROGRAM + ", ); //THEN I expect both PouIndexEntries @@ -1543,20 +1543,20 @@ fn type_duplicates_are_indexed() { // WHEN the code is indexed let (_, index) = index( " - TYPE MyStruct: - STRUCT + TYPE MyStruct: + STRUCT field1 : INT; END_STRUCT END_TYPE - - TYPE MyStruct: - STRUCT + + TYPE MyStruct: + STRUCT field2 : INT; END_STRUCT END_TYPE - TYPE MyStruct: - STRUCT + TYPE MyStruct: + STRUCT field3 : INT; END_STRUCT END_TYPE diff --git a/src/index/tests/instance_resolver_tests.rs b/src/index/tests/instance_resolver_tests.rs index 24cef3d0f2..57ad7e907c 100644 --- a/src/index/tests/instance_resolver_tests.rs +++ b/src/index/tests/instance_resolver_tests.rs @@ -63,7 +63,7 @@ fn program_variables_are_retrieved() { fn global_struct_variables_are_retrieved() { let (_, index) = index( " - TYPE str : STRUCT + TYPE str : STRUCT a,b : DINT; END_STRUCT END_TYPE @@ -84,11 +84,11 @@ fn global_struct_variables_are_retrieved() { fn nested_global_struct_variables_are_retrieved() { let (_, index) = index( " - TYPE str : STRUCT + TYPE str : STRUCT a,b : str2; END_STRUCT END_TYPE - TYPE str2 : STRUCT + TYPE str2 : STRUCT c,d : DINT; END_STRUCT END_TYPE @@ -109,7 +109,7 @@ fn nested_global_struct_variables_are_retrieved() { fn global_fb_variables_are_retrieved() { let (_, index) = index( " - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR a,b : DINT; END_VAR @@ -131,7 +131,7 @@ fn global_fb_variables_are_retrieved() { fn array_instances_are_repeated() { let (_, index) = index( " - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR c,b : DINT; END_VAR @@ -152,7 +152,7 @@ fn array_instances_are_repeated() { fn array_with_const_instances_are_repeated() { let (_, index) = index( " - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR c,b : DINT; END_VAR @@ -174,7 +174,7 @@ fn array_with_const_instances_are_repeated() { fn pointer_variables_are_not_retrieved() { let (_, index) = index( " - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR a,b : DINT; END_VAR @@ -193,7 +193,7 @@ fn pointer_variables_are_not_retrieved() { fn filter_on_variables_are_applied() { let (_, index) = index( " - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR a,b : DINT; END_VAR diff --git a/src/index/tests/snapshots/rusty__index__tests__index_tests__fb_parameters_variable_type.snap b/src/index/tests/snapshots/rusty__index__tests__index_tests__fb_parameters_variable_type.snap index 940a676c60..e068ad0b1d 100644 --- a/src/index/tests/snapshots/rusty__index__tests__index_tests__fb_parameters_variable_type.snap +++ b/src/index/tests/snapshots/rusty__index__tests__index_tests__fb_parameters_variable_type.snap @@ -19,12 +19,12 @@ expression: members span: Range( TextLocation { line: 3, - column: 3, - offset: 36, + column: 12, + offset: 57, }..TextLocation { line: 3, - column: 9, - offset: 42, + column: 18, + offset: 63, }, ), }, @@ -46,12 +46,12 @@ expression: members span: Range( TextLocation { line: 6, - column: 3, - offset: 76, + column: 12, + offset: 118, }..TextLocation { line: 6, - column: 10, - offset: 83, + column: 19, + offset: 125, }, ), }, @@ -73,12 +73,12 @@ expression: members span: Range( TextLocation { line: 9, - column: 3, - offset: 117, + column: 12, + offset: 180, }..TextLocation { line: 9, - column: 9, - offset: 123, + column: 18, + offset: 186, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__index_tests__function_parameters_variable_type.snap b/src/index/tests/snapshots/rusty__index__tests__index_tests__function_parameters_variable_type.snap index 3f40c6b7a4..ff411aff36 100644 --- a/src/index/tests/snapshots/rusty__index__tests__index_tests__function_parameters_variable_type.snap +++ b/src/index/tests/snapshots/rusty__index__tests__index_tests__function_parameters_variable_type.snap @@ -19,12 +19,12 @@ expression: members span: Range( TextLocation { line: 3, - column: 3, - offset: 37, + column: 12, + offset: 58, }..TextLocation { line: 3, - column: 9, - offset: 43, + column: 18, + offset: 64, }, ), }, @@ -46,12 +46,12 @@ expression: members span: Range( TextLocation { line: 6, - column: 3, - offset: 77, + column: 12, + offset: 119, }..TextLocation { line: 6, - column: 10, - offset: 84, + column: 19, + offset: 126, }, ), }, @@ -73,12 +73,12 @@ expression: members span: Range( TextLocation { line: 9, - column: 3, - offset: 118, + column: 12, + offset: 181, }..TextLocation { line: 9, - column: 9, - offset: 124, + column: 18, + offset: 187, }, ), }, @@ -100,12 +100,12 @@ expression: members span: Range( TextLocation { line: 1, - column: 11, - offset: 12, + column: 17, + offset: 18, }..TextLocation { line: 1, - column: 14, - offset: 15, + column: 20, + offset: 21, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__index_tests__program_parameters_variable_type.snap b/src/index/tests/snapshots/rusty__index__tests__index_tests__program_parameters_variable_type.snap index 04247c5601..f37056b140 100644 --- a/src/index/tests/snapshots/rusty__index__tests__index_tests__program_parameters_variable_type.snap +++ b/src/index/tests/snapshots/rusty__index__tests__index_tests__program_parameters_variable_type.snap @@ -19,12 +19,12 @@ expression: members span: Range( TextLocation { line: 3, - column: 3, - offset: 31, + column: 12, + offset: 52, }..TextLocation { line: 3, - column: 9, - offset: 37, + column: 18, + offset: 58, }, ), }, @@ -46,12 +46,12 @@ expression: members span: Range( TextLocation { line: 6, - column: 3, - offset: 71, + column: 12, + offset: 113, }..TextLocation { line: 6, - column: 10, - offset: 78, + column: 19, + offset: 120, }, ), }, @@ -73,12 +73,12 @@ expression: members span: Range( TextLocation { line: 9, - column: 3, - offset: 112, + column: 12, + offset: 175, }..TextLocation { line: 9, - column: 9, - offset: 118, + column: 18, + offset: 181, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_instances_are_repeated.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_instances_are_repeated.snap index b64e2bf1cc..25f154029f 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_instances_are_repeated.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_instances_are_repeated.snap @@ -28,11 +28,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 12, - offset: 99, + offset: 98, }..TextLocation { line: 6, column: 20, - offset: 107, + offset: 106, }, ), }, @@ -67,11 +67,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 8, column: 8, - offset: 124, + offset: 123, }..TextLocation { line: 8, column: 11, - offset: 127, + offset: 126, }, ), }, @@ -127,11 +127,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 8, - offset: 40, + offset: 39, }..TextLocation { line: 3, column: 9, - offset: 41, + offset: 40, }, ), }, @@ -187,11 +187,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 10, - offset: 42, + offset: 41, }..TextLocation { line: 3, column: 11, - offset: 43, + offset: 42, }, ), }, @@ -226,11 +226,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 9, column: 8, - offset: 157, + offset: 156, }..TextLocation { line: 9, column: 12, - offset: 161, + offset: 160, }, ), }, @@ -300,11 +300,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 8, - offset: 40, + offset: 39, }..TextLocation { line: 3, column: 9, - offset: 41, + offset: 40, }, ), }, @@ -374,11 +374,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 10, - offset: 42, + offset: 41, }..TextLocation { line: 3, column: 11, - offset: 43, + offset: 42, }, ), }, @@ -413,11 +413,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 10, column: 8, - offset: 196, + offset: 195, }..TextLocation { line: 10, column: 12, - offset: 200, + offset: 199, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_with_const_instances_are_repeated.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_with_const_instances_are_repeated.snap index 84286a371b..011abfe075 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_with_const_instances_are_repeated.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__array_with_const_instances_are_repeated.snap @@ -28,11 +28,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 12, - offset: 99, + offset: 98, }..TextLocation { line: 6, column: 20, - offset: 107, + offset: 106, }, ), }, @@ -72,11 +72,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 8, column: 8, - offset: 133, + offset: 132, }..TextLocation { line: 8, column: 12, - offset: 137, + offset: 136, }, ), }, @@ -111,11 +111,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 11, column: 8, - offset: 179, + offset: 178, }..TextLocation { line: 11, column: 11, - offset: 182, + offset: 181, }, ), }, @@ -171,11 +171,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 8, - offset: 40, + offset: 39, }..TextLocation { line: 3, column: 9, - offset: 41, + offset: 40, }, ), }, @@ -231,11 +231,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 10, - offset: 42, + offset: 41, }..TextLocation { line: 3, column: 11, - offset: 43, + offset: 42, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__filter_on_variables_are_applied.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__filter_on_variables_are_applied.snap index becb2ad39c..a2b720aae3 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__filter_on_variables_are_applied.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__filter_on_variables_are_applied.snap @@ -33,11 +33,11 @@ expression: "index.filter_instances(|it, _|\n !it.is_constant()).coll TextLocation { line: 12, column: 8, - offset: 194, + offset: 193, }..TextLocation { line: 12, column: 11, - offset: 197, + offset: 196, }, ), }, @@ -69,11 +69,11 @@ expression: "index.filter_instances(|it, _|\n !it.is_constant()).coll TextLocation { line: 6, column: 12, - offset: 99, + offset: 98, }..TextLocation { line: 6, column: 20, - offset: 107, + offset: 106, }, ), }, @@ -108,11 +108,11 @@ expression: "index.filter_instances(|it, _|\n !it.is_constant()).coll TextLocation { line: 8, column: 8, - offset: 124, + offset: 123, }..TextLocation { line: 8, column: 11, - offset: 127, + offset: 126, }, ), }, @@ -150,11 +150,11 @@ expression: "index.filter_instances(|it, _|\n !it.is_constant()).coll TextLocation { line: 3, column: 8, - offset: 40, + offset: 39, }..TextLocation { line: 3, column: 9, - offset: 41, + offset: 40, }, ), }, @@ -192,11 +192,11 @@ expression: "index.filter_instances(|it, _|\n !it.is_constant()).coll TextLocation { line: 3, column: 10, - offset: 42, + offset: 41, }..TextLocation { line: 3, column: 11, - offset: 43, + offset: 42, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_fb_variables_are_retrieved.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_fb_variables_are_retrieved.snap index 455d6e33df..2c62c3f94c 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_fb_variables_are_retrieved.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_fb_variables_are_retrieved.snap @@ -28,11 +28,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 7, column: 8, - offset: 110, + offset: 109, }..TextLocation { line: 7, column: 11, - offset: 113, + offset: 112, }, ), }, @@ -67,11 +67,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 8, - offset: 40, + offset: 39, }..TextLocation { line: 3, column: 9, - offset: 41, + offset: 40, }, ), }, @@ -106,11 +106,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 10, - offset: 42, + offset: 41, }..TextLocation { line: 3, column: 11, - offset: 43, + offset: 42, }, ), }, @@ -142,11 +142,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 9, column: 12, - offset: 144, + offset: 143, }..TextLocation { line: 9, column: 20, - offset: 152, + offset: 151, }, ), }, @@ -181,11 +181,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 11, column: 8, - offset: 169, + offset: 168, }..TextLocation { line: 11, column: 11, - offset: 172, + offset: 171, }, ), }, @@ -223,11 +223,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 8, - offset: 40, + offset: 39, }..TextLocation { line: 3, column: 9, - offset: 41, + offset: 40, }, ), }, @@ -265,11 +265,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 3, column: 10, - offset: 42, + offset: 41, }..TextLocation { line: 3, column: 11, - offset: 43, + offset: 42, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_struct_variables_are_retrieved.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_struct_variables_are_retrieved.snap index 3ed489b13d..92adee3445 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_struct_variables_are_retrieved.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__global_struct_variables_are_retrieved.snap @@ -28,11 +28,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 8, - offset: 95, + offset: 94, }..TextLocation { line: 6, column: 12, - offset: 99, + offset: 98, }, ), }, @@ -67,11 +67,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 8, - offset: 32, + offset: 31, }..TextLocation { line: 2, column: 9, - offset: 33, + offset: 32, }, ), }, @@ -106,11 +106,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 10, - offset: 34, + offset: 33, }..TextLocation { line: 2, column: 11, - offset: 35, + offset: 34, }, ), }, @@ -142,11 +142,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 8, column: 12, - offset: 131, + offset: 130, }..TextLocation { line: 8, column: 20, - offset: 139, + offset: 138, }, ), }, @@ -181,11 +181,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 10, column: 8, - offset: 156, + offset: 155, }..TextLocation { line: 10, column: 12, - offset: 160, + offset: 159, }, ), }, @@ -223,11 +223,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 8, - offset: 32, + offset: 31, }..TextLocation { line: 2, column: 9, - offset: 33, + offset: 32, }, ), }, @@ -265,11 +265,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 10, - offset: 34, + offset: 33, }..TextLocation { line: 2, column: 11, - offset: 35, + offset: 34, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__nested_global_struct_variables_are_retrieved.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__nested_global_struct_variables_are_retrieved.snap index b51373a644..8f13a244db 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__nested_global_struct_variables_are_retrieved.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__nested_global_struct_variables_are_retrieved.snap @@ -28,11 +28,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 10, column: 8, - offset: 167, + offset: 165, }..TextLocation { line: 10, column: 12, - offset: 171, + offset: 169, }, ), }, @@ -67,11 +67,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 8, - offset: 32, + offset: 31, }..TextLocation { line: 2, column: 9, - offset: 33, + offset: 32, }, ), }, @@ -109,11 +109,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 8, - offset: 104, + offset: 102, }..TextLocation { line: 6, column: 9, - offset: 105, + offset: 103, }, ), }, @@ -151,11 +151,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 10, - offset: 106, + offset: 104, }..TextLocation { line: 6, column: 11, - offset: 107, + offset: 105, }, ), }, @@ -190,11 +190,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 10, - offset: 34, + offset: 33, }..TextLocation { line: 2, column: 11, - offset: 35, + offset: 34, }, ), }, @@ -232,11 +232,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 8, - offset: 104, + offset: 102, }..TextLocation { line: 6, column: 9, - offset: 105, + offset: 103, }, ), }, @@ -274,11 +274,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 10, - offset: 106, + offset: 104, }..TextLocation { line: 6, column: 11, - offset: 107, + offset: 105, }, ), }, @@ -310,11 +310,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 12, column: 12, - offset: 203, + offset: 201, }..TextLocation { line: 12, column: 20, - offset: 211, + offset: 209, }, ), }, @@ -349,11 +349,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 14, column: 8, - offset: 228, + offset: 226, }..TextLocation { line: 14, column: 12, - offset: 232, + offset: 230, }, ), }, @@ -391,11 +391,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 8, - offset: 32, + offset: 31, }..TextLocation { line: 2, column: 9, - offset: 33, + offset: 32, }, ), }, @@ -436,11 +436,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 8, - offset: 104, + offset: 102, }..TextLocation { line: 6, column: 9, - offset: 105, + offset: 103, }, ), }, @@ -481,11 +481,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 10, - offset: 106, + offset: 104, }..TextLocation { line: 6, column: 11, - offset: 107, + offset: 105, }, ), }, @@ -523,11 +523,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 2, column: 10, - offset: 34, + offset: 33, }..TextLocation { line: 2, column: 11, - offset: 35, + offset: 34, }, ), }, @@ -568,11 +568,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 8, - offset: 104, + offset: 102, }..TextLocation { line: 6, column: 9, - offset: 105, + offset: 103, }, ), }, @@ -613,11 +613,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 10, - offset: 106, + offset: 104, }..TextLocation { line: 6, column: 11, - offset: 107, + offset: 105, }, ), }, diff --git a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__pointer_variables_are_not_retrieved.snap b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__pointer_variables_are_not_retrieved.snap index ae120560f2..33902d0def 100644 --- a/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__pointer_variables_are_not_retrieved.snap +++ b/src/index/tests/snapshots/rusty__index__tests__instance_resolver_tests__pointer_variables_are_not_retrieved.snap @@ -28,11 +28,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 6, column: 12, - offset: 99, + offset: 98, }..TextLocation { line: 6, column: 20, - offset: 107, + offset: 106, }, ), }, @@ -67,11 +67,11 @@ expression: "index.find_instances().collect::>>()" TextLocation { line: 8, column: 8, - offset: 124, + offset: 123, }..TextLocation { line: 8, column: 11, - offset: 127, + offset: 126, }, ), }, diff --git a/src/lexer/tests/lexer_tests.rs b/src/lexer/tests/lexer_tests.rs index 7e15621d69..eff07b213e 100644 --- a/src/lexer/tests/lexer_tests.rs +++ b/src/lexer/tests/lexer_tests.rs @@ -22,12 +22,12 @@ fn windows_and_linux_line_separators_ignored() { #[test] fn comments_are_ignored_by_the_lexer() { let mut lexer = lex(r" - PROGRAM (* Some Content *) END_PROGRAM + PROGRAM (* Some Content *) END_PROGRAM /* - * FUNCTION */ + * FUNCTION */ (* Nested (*) Comment *) *) /* Nested /* Comment */ */ - //END_FUNCTION FUNCTION_BLOCK + //END_FUNCTION FUNCTION_BLOCK END_FUNCTION_BLOCK "); assert_eq!(lexer.token, KeywordProgram, "Token : {}", lexer.slice()); @@ -41,7 +41,7 @@ fn comments_are_ignored_by_the_lexer() { #[test] fn undefined_pragmas_are_ignored_by_the_lexer() { let mut lexer = lex(r" - PROGRAM { Some Content } END_PROGRAM + PROGRAM { Some Content } END_PROGRAM { FUNCTION } {END_FUNCTION FUNCTION_BLOCK} @@ -72,12 +72,12 @@ fn registered_pragmas_parsed() { #[test] fn comments_are_not_ignored_in_strings() { let mut lexer = lex(r#" - 'PROGRAM (* Some Content *) END_PROGRAM + 'PROGRAM (* Some Content *) END_PROGRAM /* - * FUNCTION */ + * FUNCTION */ (* Nested (*) Comment *) *) /* Nested /* Comment */ */ - //END_FUNCTION FUNCTION_BLOCK + //END_FUNCTION FUNCTION_BLOCK END_FUNCTION_BLOCK' "#); assert_eq!(lexer.token, LiteralString, "Token : {}", lexer.slice()); @@ -105,12 +105,12 @@ fn string_delimiter_dont_leak_out_of_comments() { #[test] fn unicode_chars_in_comments() { let mut lexer = lex(r" - PROGRAM (* Some Content *) END_PROGRAM + PROGRAM (* Some Content *) END_PROGRAM /* - * FUNCTION */ + * FUNCTION */ (* Nested //2 char utf-8 -> 💖ß (*) //2 char utf-16 --> 💣 Comment *) *) /* Nested /* Comment */ */ - //END_FUNCTION FUNCTION_BLOCK + //END_FUNCTION FUNCTION_BLOCK END_FUNCTION_BLOCK "); assert_eq!(lexer.token, KeywordProgram, "Token : {}", lexer.slice()); @@ -319,7 +319,7 @@ fn date_literals_test() { fn long_date_literals_test() { let mut lexer = lex(r#" LDATE#1984-10-01 LDATE#1-1-1 - LD#1-1-1 + LD#1-1-1 INT#1 "#); for _ in 1..=3 { @@ -347,7 +347,7 @@ fn date_and_time_literals_test() { #[test] fn long_date_and_time_literals_test() { let mut lexer = lex(" - LDT#1984-10-01-20:15:12 LDT#1-1-1-1:1:1 LDT#1984-10-01-20:15 LDT#1984-10-01-20:15:12.123"); + LDT#1984-10-01-20:15:12 LDT#1-1-1-1:1:1 LDT#1984-10-01-20:15 LDT#1984-10-01-20:15:12.123"); for _ in 1..=4 { assert_eq!(lexer.token, LiteralDateAndTime); lexer.advance(); @@ -395,8 +395,8 @@ fn time_literals_test() { fn ltime_literals_test() { let mut lexer = lex(r#" LTIME#12d - LTIME#10M4S - LT#10d + LTIME#10M4S + LT#10d DINT#10 "#); for _ in 1..=3 { @@ -621,9 +621,9 @@ fn type_cast_prefixes_parsing() { #[test] fn wide_string_parsing() { let mut lexer = lex(r#" - WSTRING - "AB C" - "AB$$" + WSTRING + "AB C" + "AB$$" "AB$"" "#); @@ -644,7 +644,7 @@ fn wide_string_parsing() { #[test] fn pointers_and_references_keyword() { let mut lexer = lex(r#" - POINTER TO x + POINTER TO x REF_TO x REFTO x &x @@ -805,18 +805,18 @@ fn multi_named_keywords_without_underscore_test() { fn lowercase_keywords_accepted() { let mut result = lex(r###" program class end_class endclass var_input varinput var_output - varoutput var abstract final method constant retain non_retain + varoutput var abstract final method constant retain non_retain nonretain var_temp vartemp end_method endmethod public private internal protected override var_global varglobal var_in_out varinout end_var endvar end_program endprogram end_function endfunction end_function_block endfunctionblock - type struct end_type endtype end_struct endstruct - actions action end_action endaction end_actions endactions + type struct end_type endtype end_struct endstruct + actions action end_action endaction end_actions endactions if then elsif else endif end_if for to by do end_for endfor while end_while endwhile repeat until endrepeat end_repeat - case return exit continue array string wstring - of endcase end_case mod and or xor not true false + case return exit continue array string wstring + of endcase end_case mod and or xor not true false d#1-2-3 date#1-2-3 dt#1-2-3-1:2:3 date_and_time#1-2-3-1:2:3 tod#1:2:3 time_of_day#1:2:3 time#1s t#1s null refto pointer ref_to "###); diff --git a/src/parser/tests/class_parser_tests.rs b/src/parser/tests/class_parser_tests.rs index 6117cc5529..e585719505 100644 --- a/src/parser/tests/class_parser_tests.rs +++ b/src/parser/tests/class_parser_tests.rs @@ -20,9 +20,9 @@ fn simple_class_with_defaults_can_be_parsed() { #[test] fn extends_can_be_parsed() { let src = " - CLASS MyClass + CLASS MyClass END_CLASS - + CLASS MyClass2 EXTENDS MyClass END_CLASS "; diff --git a/src/parser/tests/control_parser_tests.rs b/src/parser/tests/control_parser_tests.rs index 9179d08d52..b09862b2b1 100644 --- a/src/parser/tests/control_parser_tests.rs +++ b/src/parser/tests/control_parser_tests.rs @@ -11,7 +11,7 @@ use pretty_assertions::*; #[test] fn if_statement() { let src = " - PROGRAM exp + PROGRAM exp IF TRUE THEN END_IF END_PROGRAM @@ -69,7 +69,7 @@ fn test_exit_statement() { #[test] fn if_else_statement_with_expressions() { let src = " - PROGRAM exp + PROGRAM exp IF TRUE THEN x; ELSE @@ -87,7 +87,7 @@ fn if_else_statement_with_expressions() { #[test] fn if_elsif_elsif_else_statement_with_expressions() { let src = " - PROGRAM exp + PROGRAM exp IF TRUE THEN x; ELSIF y THEN @@ -109,7 +109,7 @@ fn if_elsif_elsif_else_statement_with_expressions() { #[test] fn for_with_literals_statement() { let src = " - PROGRAM exp + PROGRAM exp FOR y := x TO 10 DO END_FOR END_PROGRAM @@ -124,8 +124,8 @@ fn for_with_literals_statement() { #[test] fn for_with_step_statement() { let src = " - PROGRAM exp - FOR x := 1 TO 10 BY 7 DO + PROGRAM exp + FOR x := 1 TO 10 BY 7 DO END_FOR END_PROGRAM "; @@ -139,7 +139,7 @@ fn for_with_step_statement() { #[test] fn for_with_reference_statement() { let src = " - PROGRAM exp + PROGRAM exp FOR z := x TO y DO END_FOR END_PROGRAM @@ -154,7 +154,7 @@ fn for_with_reference_statement() { #[test] fn for_with_body_statement() { let src = " - PROGRAM exp + PROGRAM exp FOR z := x TO y DO x; y; @@ -172,7 +172,7 @@ fn for_with_body_statement() { #[test] fn while_with_literal() { let src = " - PROGRAM exp + PROGRAM exp WHILE TRUE DO END_WHILE END_PROGRAM @@ -195,8 +195,8 @@ fn while_with_literal() { #[test] fn while_with_expression() { let src = " - PROGRAM exp - WHILE x < 7 DO + PROGRAM exp + WHILE x < 7 DO END_WHILE END_PROGRAM "; @@ -210,7 +210,7 @@ fn while_with_expression() { #[test] fn while_with_body_statement() { let src = " - PROGRAM exp + PROGRAM exp WHILE TRUE DO x; y; @@ -227,7 +227,7 @@ fn while_with_body_statement() { #[test] fn repeat_with_literal() { let src = " - PROGRAM exp + PROGRAM exp REPEAT UNTIL TRUE END_REPEAT @@ -251,7 +251,7 @@ fn repeat_with_literal() { #[test] fn repeat_with_expression() { let src = " - PROGRAM exp + PROGRAM exp REPEAT UNTIL x > 7 END_REPEAT @@ -267,7 +267,7 @@ fn repeat_with_expression() { #[test] fn repeat_with_body_statement() { let src = " - PROGRAM exp + PROGRAM exp REPEAT x; y; @@ -286,7 +286,7 @@ fn repeat_with_body_statement() { #[test] fn case_statement_with_one_condition() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF 1: x; END_CASE @@ -303,7 +303,7 @@ fn case_statement_with_one_condition() { #[test] fn case_statement_with_one_condition_with_trailling_comma() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF 1,: x; END_CASE @@ -321,7 +321,7 @@ fn case_statement_with_one_condition_with_trailling_comma() { #[test] fn case_statement_with_else_and_no_condition() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF ELSE END_CASE @@ -337,7 +337,7 @@ fn case_statement_with_else_and_no_condition() { #[test] fn case_statement_with_no_conditions() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF END_CASE END_PROGRAM @@ -352,7 +352,7 @@ fn case_statement_with_no_conditions() { #[test] fn case_statement_with_one_condition_and_an_else() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF 1: x; ELSE @@ -371,7 +371,7 @@ fn case_statement_with_one_condition_and_an_else() { #[test] fn case_statement_with_one_empty_condition_and_an_else() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF 1: ELSE @@ -390,7 +390,7 @@ fn case_statement_with_one_empty_condition_and_an_else() { #[test] fn case_statement_with_multiple_conditions() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF 1: x; 2: y; yy; yyy; @@ -409,7 +409,7 @@ fn case_statement_with_multiple_conditions() { #[test] fn case_statement_with_multiple_expressions_per_condition() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine OF 1,2,3: x; 4..5, 6: y; @@ -426,7 +426,7 @@ fn case_statement_with_multiple_expressions_per_condition() { #[test] fn if_stmnt_location_test() { let source = " - PROGRAM prg + PROGRAM prg IF a > 4 THEN a + b; ELSIF x < 2 THEN @@ -462,7 +462,7 @@ fn if_stmnt_location_test() { #[test] fn for_stmnt_location_test() { let source = " - PROGRAM prg + PROGRAM prg FOR x := 3 TO 9 BY 2 DO a + b; END_FOR @@ -504,7 +504,7 @@ fn for_stmnt_location_test() { #[test] fn while_stmnt_location_test() { let source = " - PROGRAM prg + PROGRAM prg WHILE a < 2 DO a := a - 1; END_WHILE @@ -526,7 +526,7 @@ fn while_stmnt_location_test() { #[test] fn case_stmnt_location_test() { let source = " - PROGRAM prg + PROGRAM prg CASE a OF 1: a := a - 1; @@ -554,7 +554,7 @@ fn case_stmnt_location_test() { #[test] fn call_stmnt_location_test() { let source = " - PROGRAM prg + PROGRAM prg foo(a:=3, b:=4); END_PROGRAM"; diff --git a/src/parser/tests/expressions_parser_tests.rs b/src/parser/tests/expressions_parser_tests.rs index 436c847aa2..7bef1c74e8 100644 --- a/src/parser/tests/expressions_parser_tests.rs +++ b/src/parser/tests/expressions_parser_tests.rs @@ -29,13 +29,13 @@ fn qualified_reference_statement_parsed() { #[test] fn bitwise_access_parsed() { - let src = "PROGRAM exp - a.0; - a.%X1; - a.%B1; + let src = "PROGRAM exp + a.0; + a.%X1; + a.%B1; a.%Bb; - a[0].%W1; - a.b.%D1; + a[0].%W1; + a.b.%D1; a.%B1.%X1; END_PROGRAM"; let (result, diagnostics) = parse(src); @@ -121,8 +121,8 @@ fn literal_oct_number_with_underscore_can_be_parsed() { #[test] fn binary_stmts_of_two_variables_parsed() { - let src = "PROGRAM exp - x+y; + let src = "PROGRAM exp + x+y; x.y = y.z; x.y - y.z; &x.y = y.z; @@ -266,8 +266,8 @@ fn equality_expression_test() { #[test] fn comparison_expression_test() { - let src = "PROGRAM exp - a < 3; + let src = "PROGRAM exp + a < 3; b > 0; c <= 7; d >= 4; @@ -304,7 +304,7 @@ fn boolean_expression_param_ast_test() { #[test] fn signed_literal_minus_test() { let src = " - PROGRAM exp + PROGRAM exp -1; END_PROGRAM "; @@ -319,9 +319,9 @@ fn signed_literal_minus_test() { #[test] fn literal_date_test() { let src = " - PROGRAM exp - DATE#1984-10-01; - D#2021-04-20; + PROGRAM exp + DATE#1984-10-01; + D#2021-04-20; END_PROGRAM "; let result = parse(src).0; @@ -344,8 +344,8 @@ fn literal_date_test() { #[test] fn literal_long_date_test() { let src = " - PROGRAM exp - LDATE#1984-10-01; + PROGRAM exp + LDATE#1984-10-01; END_PROGRAM "; let result = parse(src).0; @@ -363,7 +363,7 @@ fn literal_long_date_test() { #[test] fn literal_time_test() { let src = " - PROGRAM exp + PROGRAM exp T#12d; T#12.4d; TIME#-12m; @@ -475,7 +475,7 @@ fn literal_time_test() { #[test] fn literal_long_time_test() { let src = " - PROGRAM exp + PROGRAM exp LTIME#12d; LTIME#12.4d; END_PROGRAM @@ -510,14 +510,14 @@ fn literal_long_time_test() { #[test] fn literal_time_of_day_test() { let src = " - PROGRAM exp + PROGRAM exp TOD#12:00:00; TOD#00:12:00; TOD#00:00:12; TIME_OF_DAY#04:16:22; TIME_OF_DAY#04:16:22.1; TIME_OF_DAY#04:16:22.001002003; - TIME_OF_DAY#04:16; + TIME_OF_DAY#04:16; END_PROGRAM "; let result = parse(src).0; @@ -572,7 +572,7 @@ fn literal_time_of_day_test() { #[test] fn literal_long_time_of_day_test() { let src = " - PROGRAM exp + PROGRAM exp LTOD#12:00:00.123456789; LTOD#00:12:00.99; LTOD#00:00:12; @@ -606,11 +606,11 @@ fn literal_long_time_of_day_test() { #[test] fn literal_date_and_time_test() { let src = " - PROGRAM exp - DATE_AND_TIME#1984-10-01-16:40:22; - DT#2021-04-20-22:33:14; - DT#2021-04-20-22:33:14.999999999; - DATE_AND_TIME#2000-01-01-20:15; + PROGRAM exp + DATE_AND_TIME#1984-10-01-16:40:22; + DT#2021-04-20-22:33:14; + DT#2021-04-20-22:33:14.999999999; + DATE_AND_TIME#2000-01-01-20:15; END_PROGRAM "; let result = parse(src).0; @@ -659,8 +659,8 @@ fn literal_date_and_time_test() { #[test] fn literal_long_date_and_time_test() { let src = " - PROGRAM exp - LDT#1984-10-01-16:40:22.123456789; + PROGRAM exp + LDT#1984-10-01-16:40:22.123456789; LDT#2021-04-20-22:33:14; END_PROGRAM "; @@ -692,7 +692,7 @@ fn literal_long_date_and_time_test() { #[test] fn literal_real_test() { let src = " - PROGRAM exp + PROGRAM exp 1.1; 1.2e3; 1.2e-4; @@ -748,7 +748,7 @@ fn cast(data_type: &str, value: AstNode) -> AstNode { #[test] fn literal_enum_parse_test() { let src = r#" - PROGRAM exp + PROGRAM exp MyEnum#Val7; MyEnum#Val2; MyEnum#Val3; @@ -764,7 +764,7 @@ fn literal_enum_parse_test() { #[test] fn literal_cast_parse_test() { let src = r#" - PROGRAM exp + PROGRAM exp SINT#100; DINT#16#AFFE; BYTE#8#77; @@ -776,8 +776,8 @@ fn literal_cast_parse_test() { BOOL#FALSE; STRING#"abc"; WSTRING#'xyz'; - CHAR#"A"; - WCHAR#'B'; + CHAR#"A"; + WCHAR#'B'; END_PROGRAM "#; let result = parse(src).0; @@ -816,7 +816,7 @@ fn literal_cast_parse_test() { #[test] fn literal_exponents_test() { let src = " - PROGRAM exp + PROGRAM exp 1_2e3; 12e3; 12.0e3; @@ -857,7 +857,7 @@ fn literal_exponents_test() { #[test] fn signed_literal_expression_test() { let src = " - PROGRAM exp + PROGRAM exp 2 +-x; END_PROGRAM "; @@ -872,7 +872,7 @@ fn signed_literal_expression_test() { #[test] fn assignment_to_null() { let src = " - PROGRAM exp + PROGRAM exp x := NULL; END_PROGRAM "; @@ -887,12 +887,12 @@ fn assignment_to_null() { #[test] fn assignment_to_number_with_implicit_and_explicit_plus_sign() { let src = " - PROGRAM exp - VAR - x : INT; - END_VAR - x := 1; - x := +1; + PROGRAM exp + VAR + x : INT; + END_VAR + x := 1; + x := +1; END_PROGRAM "; @@ -905,12 +905,12 @@ fn assignment_to_number_with_implicit_and_explicit_plus_sign() { #[test] fn assignment_to_number_reference_with_explicit_plus_sign() { let src = " - PROGRAM exp - VAR - x : INT; - END_VAR - x := 1; - x := +x; + PROGRAM exp + VAR + x : INT; + END_VAR + x := 1; + x := +x; END_PROGRAM "; @@ -922,7 +922,7 @@ fn assignment_to_number_reference_with_explicit_plus_sign() { #[test] fn pointer_address_test() { let src = " - PROGRAM exp + PROGRAM exp &x; END_PROGRAM "; @@ -936,7 +936,7 @@ fn pointer_address_test() { #[test] fn pointer_dereference_test() { let src = " - PROGRAM exp + PROGRAM exp x^; END_PROGRAM "; @@ -951,7 +951,7 @@ fn pointer_dereference_test() { #[test] fn pointer_dereference_test_nested() { let src = " - PROGRAM exp + PROGRAM exp x^^[0][1]^[2]^^; END_PROGRAM "; @@ -966,7 +966,7 @@ fn pointer_dereference_test_nested() { #[test] fn signed_literal_expression_reversed_test() { let src = " - PROGRAM exp + PROGRAM exp -4 + 5; END_PROGRAM "; @@ -981,7 +981,7 @@ fn signed_literal_expression_reversed_test() { #[test] fn or_compare_expressions_priority_test() { let src = " - PROGRAM exp + PROGRAM exp x > 1 OR b1; END_PROGRAM "; @@ -996,7 +996,7 @@ fn or_compare_expressions_priority_test() { #[test] fn addition_compare_or_priority_test() { let src = " - PROGRAM exp + PROGRAM exp x + 1 > 2 OR b1; END_PROGRAM "; @@ -1054,7 +1054,7 @@ fn amp_as_and_with_address_test() { #[test] fn boolean_priority_test() { let src = " - PROGRAM exp + PROGRAM exp a AND b XOR c OR d; END_PROGRAM "; @@ -1069,7 +1069,7 @@ fn boolean_priority_test() { #[test] fn comparison_priority_test() { let src = " - PROGRAM exp + PROGRAM exp x < 7 = y > 6; END_PROGRAM "; @@ -1084,7 +1084,7 @@ fn comparison_priority_test() { fn expression_list() { //technically this is an illegal state, the parser will accept it though let src = " - PROGRAM exp + PROGRAM exp 1,2,3; END_PROGRAM "; @@ -1100,7 +1100,7 @@ fn expression_list() { fn expression_list_assignments() { //technically this is an illegal state, the parser will accept it though let src = " - PROGRAM exp + PROGRAM exp x := 1, y := 2, z:= 3; END_PROGRAM "; @@ -1115,7 +1115,7 @@ fn expression_list_assignments() { #[test] fn range_expression() { let src = " - PROGRAM exp + PROGRAM exp a..b; 1..2; a..2; @@ -1133,7 +1133,7 @@ fn range_expression() { #[test] fn negative_range_expression() { let src = " - PROGRAM exp + PROGRAM exp -2..-1; END_PROGRAM "; @@ -1158,7 +1158,7 @@ fn negative_range_expression() { #[test] fn negative_range_expression_space() { let src = " - PROGRAM exp + PROGRAM exp -2 ..-1; END_PROGRAM "; @@ -1183,7 +1183,7 @@ fn negative_range_expression_space() { #[test] fn range_expression2() { let src = " - PROGRAM exp + PROGRAM exp 1 .. 2; END_PROGRAM "; @@ -1567,7 +1567,7 @@ fn qualified_reference_location_test() { #[test] fn expressions_location_test() { let source = " - PROGRAM prg + PROGRAM prg a + b; x + z - y + u - v; -x; diff --git a/src/parser/tests/function_parser_tests.rs b/src/parser/tests/function_parser_tests.rs index 73b5e1f25f..232ed75c4b 100644 --- a/src/parser/tests/function_parser_tests.rs +++ b/src/parser/tests/function_parser_tests.rs @@ -412,7 +412,7 @@ fn function_bool_return_supported() { fn function_type_enum_return_supported() { // GIVEN FUNCTION returning a type ENUM let function = "TYPE MyEnum: (green, yellow, red); END_TYPE - FUNCTION foo : MyEnum VAR_INPUT END_VAR END_FUNCTION"; + FUNCTION foo : MyEnum VAR_INPUT END_VAR END_FUNCTION"; //WHEN parsing is done let (_parse_result, diagnostics) = parse(function); //THEN there shouldn't be any diagnostics -> valid return type @@ -423,7 +423,7 @@ fn function_type_enum_return_supported() { fn function_type_struct_return_supported() { // GIVEN FUNCTION returning a type STRUCT let function = "TYPE MyStruct: STRUCT x : INT; y : INT; END_STRUCT END_TYPE - FUNCTION foo : MyStruct VAR_INPUT END_VAR END_FUNCTION"; + FUNCTION foo : MyStruct VAR_INPUT END_VAR END_FUNCTION"; //WHEN parsing is done let (_parse_result, diagnostics) = parse(function); //THEN there shouldn't be any diagnostics -> valid return type diff --git a/src/parser/tests/misc_parser_tests.rs b/src/parser/tests/misc_parser_tests.rs index 1f087f5f01..1e81fe680c 100644 --- a/src/parser/tests/misc_parser_tests.rs +++ b/src/parser/tests/misc_parser_tests.rs @@ -297,7 +297,7 @@ fn ids_are_assigned_to_if_statements() { PROGRAM PRG IF TRUE THEN ; - ELSE + ELSE ; END_IF END_PROGRAM diff --git a/src/parser/tests/parse_errors/parse_error_containers_tests.rs b/src/parser/tests/parse_errors/parse_error_containers_tests.rs index 4c755844a9..ff10d34d77 100644 --- a/src/parser/tests/parse_errors/parse_error_containers_tests.rs +++ b/src/parser/tests/parse_errors/parse_error_containers_tests.rs @@ -15,7 +15,7 @@ use insta::{assert_debug_snapshot, assert_snapshot}; #[test] fn missing_pou_name() { let src = r" - PROGRAM + PROGRAM VAR END_VAR a; END_PROGRAM @@ -34,7 +34,7 @@ fn missing_pou_name() { fn missing_pou_name_2() { // in this case, a becomes the POU's name let src = r" - PROGRAM + PROGRAM a := 2; x; END_PROGRAM diff --git a/src/parser/tests/parse_errors/parse_error_literals_tests.rs b/src/parser/tests/parse_errors/parse_error_literals_tests.rs index 5a562585f3..0d16b5ef8f 100644 --- a/src/parser/tests/parse_errors/parse_error_literals_tests.rs +++ b/src/parser/tests/parse_errors/parse_error_literals_tests.rs @@ -7,7 +7,7 @@ use crate::test_utils::tests::{parse, parse_and_validate_buffered, parse_buffere #[test] fn illegal_literal_time_missing_segments_test() { let src = " - PROGRAM exp + PROGRAM exp T#; END_PROGRAM "; @@ -18,7 +18,7 @@ fn illegal_literal_time_missing_segments_test() { #[test] fn time_literal_problems_can_be_recovered_from_during_parsing() { let src = " - PROGRAM exp + PROGRAM exp T#1d4d2h3m; x; END_PROGRAM @@ -33,7 +33,7 @@ fn time_literal_problems_can_be_recovered_from_during_parsing() { #[test] fn illegal_literal_time_double_segments_test() { let src = " - PROGRAM exp + PROGRAM exp T#1d4d2h3m; END_PROGRAM "; @@ -45,7 +45,7 @@ fn illegal_literal_time_double_segments_test() { #[test] fn illegal_literal_time_out_of_order_segments_test() { let src = " - PROGRAM exp + PROGRAM exp T#1s2h3d; END_PROGRAM "; diff --git a/src/parser/tests/parse_errors/parse_error_messages_test.rs b/src/parser/tests/parse_errors/parse_error_messages_test.rs index 69062d7201..d07548a8a6 100644 --- a/src/parser/tests/parse_errors/parse_error_messages_test.rs +++ b/src/parser/tests/parse_errors/parse_error_messages_test.rs @@ -26,7 +26,7 @@ fn test_unexpected_token_error_message2() { #[test] fn for_with_unexpected_token_1() { let src = " - PROGRAM exp + PROGRAM exp FOR z ALPHA x TO y DO x; y; @@ -40,7 +40,7 @@ fn for_with_unexpected_token_1() { #[test] fn for_with_unexpected_token_2() { let src = " - PROGRAM exp + PROGRAM exp FOR z := x BRAVO y DO x; y; @@ -54,7 +54,7 @@ fn for_with_unexpected_token_2() { #[test] fn if_then_with_unexpected_token() { let src = " - PROGRAM exp + PROGRAM exp IF TRUE CHARLIE x; ELSE @@ -69,7 +69,7 @@ fn if_then_with_unexpected_token() { #[test] fn case_with_unexpected_token() { let src = " - PROGRAM exp + PROGRAM exp CASE StateMachine DELTA 1: x; END_CASE @@ -82,7 +82,7 @@ fn case_with_unexpected_token() { #[test] fn test_unclosed_body_error_message() { let src = " - + PROGRAM My_PRG "; diff --git a/src/parser/tests/parse_errors/parse_error_statements_tests.rs b/src/parser/tests/parse_errors/parse_error_statements_tests.rs index dde698cf17..ca29b7abba 100644 --- a/src/parser/tests/parse_errors/parse_error_statements_tests.rs +++ b/src/parser/tests/parse_errors/parse_error_statements_tests.rs @@ -23,7 +23,7 @@ fn missing_semicolon_after_call() { * parsed correctly */ let src = r" - PROGRAM foo + PROGRAM foo buz() foo(); END_PROGRAM @@ -45,7 +45,7 @@ fn missing_comma_in_call_parameters() { * c will not be parsed as an expression */ let src = r" - PROGRAM foo + PROGRAM foo buz(a,b c); END_PROGRAM "; @@ -79,7 +79,7 @@ fn illegal_semicolon_in_call_parameters() { * _ c will be its own reference with an illegal token ')' */ let src = r" - PROGRAM foo + PROGRAM foo buz(a,b; c); END_PROGRAM "; @@ -113,7 +113,7 @@ fn illegal_semicolon_in_call_parameters() { #[test] fn incomplete_statement_test() { let src = " - PROGRAM exp + PROGRAM exp 1 + 2 +; x; END_PROGRAM @@ -153,7 +153,7 @@ fn incomplete_statement_test() { #[test] fn incomplete_statement_in_parantheses_recovery_test() { let src = " - PROGRAM exp + PROGRAM exp (1 + 2 - ) + 3; x; END_PROGRAM @@ -168,7 +168,7 @@ fn incomplete_statement_in_parantheses_recovery_test() { #[test] fn mismatched_parantheses_recovery_test() { let src = " - PROGRAM exp + PROGRAM exp (1 + 2; x; END_PROGRAM @@ -185,7 +185,7 @@ fn mismatched_parantheses_recovery_test() { fn invalid_variable_name_error_recovery() { let src = " PROGRAM p - VAR + VAR c : INT; 4 : INT; END_VAR @@ -225,7 +225,7 @@ fn invalid_variable_name_error_recovery() { fn invalid_variable_data_type_error_recovery() { let src = " PROGRAM p - VAR + VAR a DINT : ; c : INT; h , , : INT; @@ -365,8 +365,8 @@ fn test_for_with_missing_semicolon_in_body() { fn test_nested_for_with_missing_end_for() { //regress, this used to end in an endless loop let src = "PROGRAM My_PRG - FOR x := 1 TO 2 DO - FOR x := 1 TO 2 DO + FOR x := 1 TO 2 DO + FOR x := 1 TO 2 DO y := x; END_FOR x := y; @@ -464,7 +464,7 @@ fn test_repeat_with_missing_semicolon_in_body() { REPEAT x := 3 UNTIL x = y END_REPEAT - y := x; + y := x; END_PROGRAM "; let (unit, diagnostics) = parse_buffered(src); @@ -542,7 +542,7 @@ fn test_nested_repeat_with_missing_until_end_repeat() { REPEAT ; UNTIL x = y END_REPEAT - y := x; + y := x; END_PROGRAM "; let (unit, diagnostics) = parse_buffered(src); @@ -771,7 +771,7 @@ fn test_while_with_missing_semicolon_in_body() { WHILE x = y DO x := 3 END_WHILE - y := x; + y := x; END_PROGRAM "; let (unit, diagnostics) = parse_buffered(src); @@ -1059,7 +1059,7 @@ fn test_case_body_with_missing_semicolon() { fn test_case_without_condition() { let src = "PROGRAM My_PRG CASE x OF - 1: + 1: : x := 3; END_CASE END_PROGRAM @@ -1117,7 +1117,7 @@ fn pointer_type_without_to_test() { let src = r#" TYPE SamplePointer : POINTER INT; - END_TYPE + END_TYPE "#; let (result, diagnostics) = parse_buffered(src); let pointer_type = &result.user_types[0]; @@ -1143,7 +1143,7 @@ fn pointer_type_with_wrong_keyword_to_test() { let src = r#" TYPE SamplePointer : POINTER tu INT; - END_TYPE + END_TYPE "#; let (result, diagnostics) = parse_buffered(src); let pointer_type = &result.user_types[0]; @@ -1165,7 +1165,7 @@ fn pointer_type_with_wrong_keyword_to_test() { #[test] fn bitwise_access_error_validation() { - let src = "PROGRAM exp + let src = "PROGRAM exp a.1e5; // exponent illegal b.%f6; // f is no valid direct access modifier END_PROGRAM"; diff --git a/src/parser/tests/parse_generics.rs b/src/parser/tests/parse_generics.rs index 344fc7e9e8..3a26b5eed9 100644 --- a/src/parser/tests/parse_generics.rs +++ b/src/parser/tests/parse_generics.rs @@ -6,12 +6,12 @@ use crate::test_utils::tests::parse; #[test] fn generic_markers_on_pou_added() { let src = "FUNCTION test< - A: ANY, - B : ANY_DERIVED, - C : ANY_ELEMENTARY, - D: ANY_MAGNITUDE, - E: ANY_NUM, - F : ANY_REAL, + A: ANY, + B : ANY_DERIVED, + C : ANY_ELEMENTARY, + D: ANY_MAGNITUDE, + E: ANY_NUM, + F : ANY_REAL, G : ANY_INT, H : ANY_SIGNED, I : ANY_UNSIGNED, diff --git a/src/parser/tests/snapshots/rusty__parser__tests__statement_parser_tests__empty_parameter_assignments_in_call_statement.snap b/src/parser/tests/snapshots/rusty__parser__tests__statement_parser_tests__empty_parameter_assignments_in_call_statement.snap index c40e00550a..ff923232fc 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__statement_parser_tests__empty_parameter_assignments_in_call_statement.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__statement_parser_tests__empty_parameter_assignments_in_call_statement.snap @@ -93,12 +93,12 @@ CompilationUnit { span: Range( TextLocation { line: 11, - column: 2, - offset: 150, + column: 8, + offset: 219, }..TextLocation { line: 11, - column: 14, - offset: 162, + column: 20, + offset: 231, }, ), }, @@ -179,12 +179,12 @@ CompilationUnit { span: Range( TextLocation { line: 17, - column: 2, - offset: 215, + column: 8, + offset: 317, }..TextLocation { line: 18, - column: 13, - offset: 270, + column: 19, + offset: 378, }, ), }, @@ -192,12 +192,12 @@ CompilationUnit { span: Range( TextLocation { line: 13, - column: 10, - offset: 174, + column: 16, + offset: 249, }..TextLocation { line: 13, - column: 14, - offset: 178, + column: 20, + offset: 253, }, ), }, diff --git a/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__global_var_with_address.snap b/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__global_var_with_address.snap index 869bc4f8b8..62321eb9de 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__global_var_with_address.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__global_var_with_address.snap @@ -2,4 +2,4 @@ source: src/parser/tests/variable_parser_tests.rs expression: "format!(\"{result:?}\")" --- -CompilationUnit { global_vars: [VariableBlock { variables: [Variable { name: "a", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 1, column: 14, offset: 26 }..TextLocation { line: 1, column: 20, offset: 32 }) } }) }, Variable { name: "b", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 2, column: 14, offset: 55 }..TextLocation { line: 2, column: 20, offset: 61 }) } }) }, Variable { name: "c", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 3, column: 14, offset: 84 }..TextLocation { line: 3, column: 20, offset: 90 }) } }) }, Variable { name: "aa", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Bit, address: [LiteralInteger { value: 7 }], location: SourceLocation { span: Range(TextLocation { line: 4, column: 15, offset: 114 }..TextLocation { line: 4, column: 22, offset: 121 }) } }) }, Variable { name: "bb", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Byte, address: [LiteralInteger { value: 5 }, LiteralInteger { value: 5 }], location: SourceLocation { span: Range(TextLocation { line: 5, column: 15, offset: 145 }..TextLocation { line: 5, column: 24, offset: 154 }) } }) }, Variable { name: "cc", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: DWord, address: [LiteralInteger { value: 3 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 6, column: 15, offset: 178 }..TextLocation { line: 6, column: 26, offset: 189 }) } }) }, Variable { name: "dd", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Global, access: DWord, address: [LiteralInteger { value: 4 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 7, column: 15, offset: 213 }..TextLocation { line: 7, column: 26, offset: 224 }) } }) }], variable_block_type: Global }], units: [], implementations: [], user_types: [], file_name: "test.st" } +CompilationUnit { global_vars: [VariableBlock { variables: [Variable { name: "a", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 1, column: 14, offset: 25 }..TextLocation { line: 1, column: 20, offset: 31 }) } }) }, Variable { name: "b", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 2, column: 14, offset: 53 }..TextLocation { line: 2, column: 20, offset: 59 }) } }) }, Variable { name: "c", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 3, column: 14, offset: 81 }..TextLocation { line: 3, column: 20, offset: 87 }) } }) }, Variable { name: "aa", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Bit, address: [LiteralInteger { value: 7 }], location: SourceLocation { span: Range(TextLocation { line: 4, column: 15, offset: 110 }..TextLocation { line: 4, column: 22, offset: 117 }) } }) }, Variable { name: "bb", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Byte, address: [LiteralInteger { value: 5 }, LiteralInteger { value: 5 }], location: SourceLocation { span: Range(TextLocation { line: 5, column: 15, offset: 140 }..TextLocation { line: 5, column: 24, offset: 149 }) } }) }, Variable { name: "cc", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: DWord, address: [LiteralInteger { value: 3 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 6, column: 15, offset: 172 }..TextLocation { line: 6, column: 26, offset: 183 }) } }) }, Variable { name: "dd", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Global, access: DWord, address: [LiteralInteger { value: 4 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 7, column: 15, offset: 206 }..TextLocation { line: 7, column: 26, offset: 217 }) } }) }], variable_block_type: Global }], units: [], implementations: [], user_types: [], file_name: "test.st" } diff --git a/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__pou_var_with_address.snap b/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__pou_var_with_address.snap index 1fda889c0f..ea7b37be94 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__pou_var_with_address.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__pou_var_with_address.snap @@ -2,4 +2,4 @@ source: src/parser/tests/variable_parser_tests.rs expression: "format!(\"{result:?}\")" --- -CompilationUnit { global_vars: [], units: [POU { name: "main", variable_blocks: [VariableBlock { variables: [Variable { name: "a", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 2, column: 14, offset: 36 }..TextLocation { line: 2, column: 20, offset: 42 }) } }) }, Variable { name: "b", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 3, column: 14, offset: 65 }..TextLocation { line: 3, column: 20, offset: 71 }) } }) }, Variable { name: "c", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 4, column: 16, offset: 96 }..TextLocation { line: 4, column: 22, offset: 102 }) } }) }, Variable { name: "d", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 4, column: 16, offset: 96 }..TextLocation { line: 4, column: 22, offset: 102 }) } }) }, Variable { name: "aa", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Bit, address: [LiteralInteger { value: 7 }], location: SourceLocation { span: Range(TextLocation { line: 5, column: 15, offset: 126 }..TextLocation { line: 5, column: 22, offset: 133 }) } }) }, Variable { name: "bb", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Byte, address: [LiteralInteger { value: 5 }, LiteralInteger { value: 5 }], location: SourceLocation { span: Range(TextLocation { line: 6, column: 15, offset: 157 }..TextLocation { line: 6, column: 24, offset: 166 }) } }) }, Variable { name: "cc", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: DWord, address: [LiteralInteger { value: 3 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 7, column: 15, offset: 190 }..TextLocation { line: 7, column: 26, offset: 201 }) } }) }, Variable { name: "dd", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Global, access: DWord, address: [LiteralInteger { value: 4 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 8, column: 15, offset: 225 }..TextLocation { line: 8, column: 26, offset: 236 }) } }) }], variable_block_type: Local }], pou_type: Program, return_type: None }], implementations: [Implementation { name: "main", type_name: "main", linkage: Internal, pou_type: Program, statements: [], location: SourceLocation { span: Range(TextLocation { line: 10, column: 4, offset: 262 }..TextLocation { line: 10, column: 15, offset: 273 }) }, name_location: SourceLocation { span: Range(TextLocation { line: 0, column: 8, offset: 8 }..TextLocation { line: 0, column: 12, offset: 12 }) }, overriding: false, generic: false, access: None }], user_types: [], file_name: "test.st" } +CompilationUnit { global_vars: [], units: [POU { name: "main", variable_blocks: [VariableBlock { variables: [Variable { name: "a", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 2, column: 14, offset: 35 }..TextLocation { line: 2, column: 20, offset: 41 }) } }) }, Variable { name: "b", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 3, column: 14, offset: 63 }..TextLocation { line: 3, column: 20, offset: 69 }) } }) }, Variable { name: "c", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 4, column: 16, offset: 93 }..TextLocation { line: 4, column: 22, offset: 99 }) } }) }, Variable { name: "d", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 4, column: 16, offset: 93 }..TextLocation { line: 4, column: 22, offset: 99 }) } }) }, Variable { name: "aa", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Bit, address: [LiteralInteger { value: 7 }], location: SourceLocation { span: Range(TextLocation { line: 5, column: 15, offset: 122 }..TextLocation { line: 5, column: 22, offset: 129 }) } }) }, Variable { name: "bb", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Byte, address: [LiteralInteger { value: 5 }, LiteralInteger { value: 5 }], location: SourceLocation { span: Range(TextLocation { line: 6, column: 15, offset: 152 }..TextLocation { line: 6, column: 24, offset: 161 }) } }) }, Variable { name: "cc", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: DWord, address: [LiteralInteger { value: 3 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 7, column: 15, offset: 184 }..TextLocation { line: 7, column: 26, offset: 195 }) } }) }, Variable { name: "dd", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Global, access: DWord, address: [LiteralInteger { value: 4 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 8, column: 15, offset: 218 }..TextLocation { line: 8, column: 26, offset: 229 }) } }) }], variable_block_type: Local }], pou_type: Program, return_type: None }], implementations: [Implementation { name: "main", type_name: "main", linkage: Internal, pou_type: Program, statements: [], location: SourceLocation { span: Range(TextLocation { line: 10, column: 4, offset: 253 }..TextLocation { line: 10, column: 15, offset: 264 }) }, name_location: SourceLocation { span: Range(TextLocation { line: 0, column: 8, offset: 8 }..TextLocation { line: 0, column: 12, offset: 12 }) }, overriding: false, generic: false, access: None }], user_types: [], file_name: "test.st" } diff --git a/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__struct_with_address.snap b/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__struct_with_address.snap index 6b762a6bb2..48935c10ba 100644 --- a/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__struct_with_address.snap +++ b/src/parser/tests/snapshots/rusty__parser__tests__variable_parser_tests__struct_with_address.snap @@ -2,4 +2,4 @@ source: src/parser/tests/variable_parser_tests.rs expression: "format!(\"{result:?}\")" --- -CompilationUnit { global_vars: [], units: [], implementations: [], user_types: [UserTypeDeclaration { data_type: StructType { name: Some("t"), variables: [Variable { name: "a", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 1, column: 14, offset: 30 }..TextLocation { line: 1, column: 20, offset: 36 }) } }) }, Variable { name: "b", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 2, column: 14, offset: 59 }..TextLocation { line: 2, column: 20, offset: 65 }) } }) }, Variable { name: "c", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 3, column: 14, offset: 88 }..TextLocation { line: 3, column: 20, offset: 94 }) } }) }, Variable { name: "aa", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Bit, address: [LiteralInteger { value: 7 }], location: SourceLocation { span: Range(TextLocation { line: 4, column: 15, offset: 118 }..TextLocation { line: 4, column: 22, offset: 125 }) } }) }, Variable { name: "bb", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Byte, address: [LiteralInteger { value: 5 }, LiteralInteger { value: 5 }], location: SourceLocation { span: Range(TextLocation { line: 5, column: 15, offset: 149 }..TextLocation { line: 5, column: 24, offset: 158 }) } }) }, Variable { name: "cc", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: DWord, address: [LiteralInteger { value: 3 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 6, column: 15, offset: 182 }..TextLocation { line: 6, column: 26, offset: 193 }) } }) }, Variable { name: "dd", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Global, access: DWord, address: [LiteralInteger { value: 4 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 7, column: 15, offset: 217 }..TextLocation { line: 7, column: 26, offset: 228 }) } }) }] }, initializer: None, scope: None }], file_name: "test.st" } +CompilationUnit { global_vars: [], units: [], implementations: [], user_types: [UserTypeDeclaration { data_type: StructType { name: Some("t"), variables: [Variable { name: "a", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 1, column: 14, offset: 30 }..TextLocation { line: 1, column: 20, offset: 36 }) } }) }, Variable { name: "b", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 2, column: 14, offset: 58 }..TextLocation { line: 2, column: 20, offset: 64 }) } }) }, Variable { name: "c", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: Template, address: [], location: SourceLocation { span: Range(TextLocation { line: 3, column: 14, offset: 86 }..TextLocation { line: 3, column: 20, offset: 92 }) } }) }, Variable { name: "aa", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Input, access: Bit, address: [LiteralInteger { value: 7 }], location: SourceLocation { span: Range(TextLocation { line: 4, column: 15, offset: 115 }..TextLocation { line: 4, column: 22, offset: 122 }) } }) }, Variable { name: "bb", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Output, access: Byte, address: [LiteralInteger { value: 5 }, LiteralInteger { value: 5 }], location: SourceLocation { span: Range(TextLocation { line: 5, column: 15, offset: 145 }..TextLocation { line: 5, column: 24, offset: 154 }) } }) }, Variable { name: "cc", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Memory, access: DWord, address: [LiteralInteger { value: 3 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 6, column: 15, offset: 177 }..TextLocation { line: 6, column: 26, offset: 188 }) } }) }, Variable { name: "dd", data_type: DataTypeReference { referenced_type: "INT" }, address: Some(HardwareAccess { direction: Global, access: DWord, address: [LiteralInteger { value: 4 }, LiteralInteger { value: 3 }, LiteralInteger { value: 3 }], location: SourceLocation { span: Range(TextLocation { line: 7, column: 15, offset: 211 }..TextLocation { line: 7, column: 26, offset: 222 }) } }) }] }, initializer: None, scope: None }], file_name: "test.st" } diff --git a/src/parser/tests/statement_parser_tests.rs b/src/parser/tests/statement_parser_tests.rs index 7c932fe27e..ffddd7578f 100644 --- a/src/parser/tests/statement_parser_tests.rs +++ b/src/parser/tests/statement_parser_tests.rs @@ -237,23 +237,23 @@ fn empty_parameter_assignments_in_call_statement() { let (result, diagnostics) = parse( r#" FUNCTION foo : INT - VAR_INPUT - input1 : INT; - END_VAR - VAR_OUTPUT - output1 : INT; - END_VAR - VAR_IN_OUT - inout1 : INT; - END_VAR - END_FUNCTION + VAR_INPUT + input1 : INT; + END_VAR + VAR_OUTPUT + output1 : INT; + END_VAR + VAR_IN_OUT + inout1 : INT; + END_VAR + END_FUNCTION - PROGRAM main - VAR - a, b, c : INT; - END_VAR - foo(input1 := , output1 => , inout1 => ); - END_PROGRAM + PROGRAM main + VAR + a, b, c : INT; + END_VAR + foo(input1 := , output1 => , inout1 => ); + END_PROGRAM "#, ); diff --git a/src/parser/tests/type_parser_tests.rs b/src/parser/tests/type_parser_tests.rs index 5bb2655a26..dec1de21a6 100644 --- a/src/parser/tests/type_parser_tests.rs +++ b/src/parser/tests/type_parser_tests.rs @@ -31,7 +31,7 @@ fn simple_struct_type_can_be_parsed() { Two:INT; Three:INT; END_STRUCT - END_TYPE + END_TYPE "#, ); @@ -88,7 +88,7 @@ fn simple_enum_type_can_be_parsed() { let (result, ..) = parse( r#" TYPE SampleEnum : (red, yellow, green); - END_TYPE + END_TYPE "#, ); insta::assert_debug_snapshot!(result.user_types[0]); @@ -99,7 +99,7 @@ fn simple_enum_with_numeric_type_can_be_parsed() { let (result, ..) = parse( r#" TYPE SampleEnum : INT (red, yellow, green); - END_TYPE + END_TYPE "#, ); insta::assert_debug_snapshot!(result.user_types[0]); @@ -110,7 +110,7 @@ fn simple_enum_with_one_element_numeric_type_can_be_parsed() { let (result, ..) = parse( r#" TYPE SampleEnum : INT (red); - END_TYPE + END_TYPE "#, ); insta::assert_debug_snapshot!(result.user_types[0]); @@ -121,7 +121,7 @@ fn typed_enum_with_initial_values_can_be_parsed() { let (result, ..) = parse( r#" TYPE SampleEnum : INT (red := 1, yellow := 2, green := 4); - END_TYPE + END_TYPE "#, ); insta::assert_debug_snapshot!(result.user_types[0]); @@ -135,7 +135,7 @@ fn typed_inline_enum_with_initial_values_can_be_parsed() { VAR x : INT (red := 1, yellow := 2, green := 4); END_VAR - END_PROGRAM + END_PROGRAM "#, ); insta::assert_debug_snapshot!(result.units[0]); @@ -145,7 +145,7 @@ fn typed_inline_enum_with_initial_values_can_be_parsed() { fn type_alias_can_be_parsed() { let (result, ..) = parse( r#" - TYPE + TYPE MyInt : INT; END_TYPE "#, @@ -226,7 +226,7 @@ fn struct_with_inline_array_can_be_parsed() { STRUCT One: ARRAY[0..1] OF INT; END_STRUCT - END_TYPE + END_TYPE "#, ); @@ -239,7 +239,7 @@ fn pointer_type_test() { r#" TYPE SamplePointer : POINTER TO INT; - END_TYPE + END_TYPE "#, ); assert_debug_snapshot!(result.user_types[0]); @@ -251,7 +251,7 @@ fn ref_type_test() { r#" TYPE SampleReference : REF_TO INT; - END_TYPE + END_TYPE "#, ); assert_debug_snapshot!(result.user_types[0]); @@ -262,10 +262,10 @@ fn ref_type_test() { fn global_pointer_declaration() { let (result, diagnostics) = parse_buffered( r#" - VAR_GLOBAL + VAR_GLOBAL SampleReference : REF_TO INT; SamplePointer : POINTER TO INT; - END_VAR + END_VAR "#, ); let reference_type = &result.global_vars[0].variables[0]; diff --git a/src/parser/tests/variable_parser_tests.rs b/src/parser/tests/variable_parser_tests.rs index 524e7650db..764ae4a80a 100644 --- a/src/parser/tests/variable_parser_tests.rs +++ b/src/parser/tests/variable_parser_tests.rs @@ -164,14 +164,14 @@ fn two_global_vars_can_be_parsed() { #[test] fn global_var_with_address() { - let src = "VAR_GLOBAL - a AT %I* : INT; - b AT %Q* : INT; - c AT %M* : INT; - aa AT %IX7 : INT; - bb AT %QB5.5 : INT; - cc AT %MD3.3.3 : INT; - dd AT %GD4.3.3 : INT; + let src = "VAR_GLOBAL + a AT %I* : INT; + b AT %Q* : INT; + c AT %M* : INT; + aa AT %IX7 : INT; + bb AT %QB5.5 : INT; + cc AT %MD3.3.3 : INT; + dd AT %GD4.3.3 : INT; END_VAR "; let (result, diag) = parse(src); @@ -183,15 +183,15 @@ fn global_var_with_address() { #[test] fn pou_var_with_address() { let src = "PROGRAM main - VAR - a AT %I* : INT; - b AT %Q* : INT; - c,d AT %M* : INT; - aa AT %IX7 : INT; - bb AT %QB5.5 : INT; - cc AT %MD3.3.3 : INT; - dd AT %GD4.3.3 : INT; - END_VAR + VAR + a AT %I* : INT; + b AT %Q* : INT; + c,d AT %M* : INT; + aa AT %IX7 : INT; + bb AT %QB5.5 : INT; + cc AT %MD3.3.3 : INT; + dd AT %GD4.3.3 : INT; + END_VAR END_PROGRAM "; let (result, diag) = parse(src); @@ -204,13 +204,13 @@ fn pou_var_with_address() { #[test] fn struct_with_address() { let src = "TYPE t : STRUCT - a AT %I* : INT; - b AT %Q* : INT; - c AT %M* : INT; - aa AT %IX7 : INT; - bb AT %QB5.5 : INT; - cc AT %MD3.3.3 : INT; - dd AT %GD4.3.3 : INT; + a AT %I* : INT; + b AT %Q* : INT; + c AT %M* : INT; + aa AT %IX7 : INT; + bb AT %QB5.5 : INT; + cc AT %MD3.3.3 : INT; + dd AT %GD4.3.3 : INT; END_STRUCT END_TYPE "; diff --git a/src/resolver/generics.rs b/src/resolver/generics.rs index 81e0d7103d..2a90620605 100644 --- a/src/resolver/generics.rs +++ b/src/resolver/generics.rs @@ -394,7 +394,7 @@ impl<'i> TypeAnnotator<'i> { .find_effective_type_by_name(current.get_name()) .map(|t| { t.has_nature(*nature, self.index) - // INT parameter for REAL is allowed + // INT parameter for REAL is allowed | (nature.is_real() & t.is_numerical()) }) .unwrap_or_default() diff --git a/src/resolver/tests/const_resolver_tests.rs b/src/resolver/tests/const_resolver_tests.rs index 0eb2d572e9..d5ac99e58d 100644 --- a/src/resolver/tests/const_resolver_tests.rs +++ b/src/resolver/tests/const_resolver_tests.rs @@ -66,7 +66,7 @@ fn const_references_to_int_compile_time_evaluation() { iZ : INT := iY; rZ : LREAL := rY; END_VAR - + VAR_GLOBAL CONSTANT a : INT := iX; b : INT := iY; @@ -115,7 +115,7 @@ fn const_enum_variable_default_value_compile_time_evaluation() { // GIVEN an enum with its first value using a const-initializer let ir = codegen( " - + VAR_GLOBAL CONSTANT me : MyEnum; THREE : INT := 3; @@ -134,7 +134,7 @@ fn local_const_references_to_int_compile_time_evaluation() { // GIVEN some INT index used as initializers let (_, index) = index( " - PROGRAM prg + PROGRAM prg VAR CONSTANT iX : INT := 4; rX : LREAL := 4.2; @@ -171,7 +171,7 @@ fn local_const_references_to_int_compile_time_evaluation_uses_correct_scopes() { h : INT := prg.a; // should be 4 END_VAR - PROGRAM prg + PROGRAM prg VAR CONSTANT a : INT := 4; END_VAR @@ -208,7 +208,7 @@ fn non_const_references_to_int_compile_time_evaluation() { a : INT := 3; b : INT := 4; END_VAR - + VAR_GLOBAL CONSTANT ok : INT := iX; nok_a : INT := iX + a; @@ -283,7 +283,7 @@ fn const_references_to_negative_reference() { iX : INT := 4; rX : LREAL := 4.2; END_VAR - + VAR_GLOBAL CONSTANT a : INT := -iX; b : LREAL := -rX; @@ -314,7 +314,7 @@ fn const_references_to_int_additions_compile_time_evaluation() { iZ : INT := iY + 7; rZ : LREAL := rY + 7.7; END_VAR - + VAR_GLOBAL CONSTANT a : INT := iX; b : INT := iY; @@ -351,7 +351,7 @@ fn const_references_to_int_subtractions_compile_time_evaluation() { iZ : INT := iY - 7; rZ : LREAL := rY - 7.7; END_VAR - + VAR_GLOBAL CONSTANT a : INT := iX; b : INT := iY; @@ -388,7 +388,7 @@ fn const_references_to_int_multiplications_compile_time_evaluation() { iZ : INT := iY * 7; rZ : LREAL := rY * 7.7; END_VAR - + VAR_GLOBAL CONSTANT a : INT := iX; b : INT := iY; @@ -425,7 +425,7 @@ fn const_references_to_int_division_compile_time_evaluation() { iZ : INT := iY / 7; rZ : LREAL := rY / 7.7; END_VAR - + VAR_GLOBAL CONSTANT a : INT := iX; b : INT := iY; @@ -606,7 +606,7 @@ fn const_references_bool_bit_functions_behavior_evaluation() { _true : BOOL := TRUE; _false : BOOL := FALSE; END_VAR - + VAR_GLOBAL CONSTANT a : WORD := _true; b : WORD := a AND _false; @@ -637,7 +637,7 @@ fn const_references_int_bit_functions_behavior_evaluation() { "VAR_GLOBAL CONSTANT _0x00ff : WORD := 16#00FF; END_VAR - + VAR_GLOBAL CONSTANT a : WORD := 16#FFAB; b : WORD := a AND _0x00ff; @@ -692,7 +692,7 @@ fn division_by_0_should_fail() { b : REAL := 5 / zero_real; c : REAL := 5.0 / zero_int; d : REAL := 5.0 / zero_real; - + aa : REAL := 5 MOD zero_int; bb : REAL := 5 MOD zero_real; cc : REAL := 5.0 MOD zero_int; @@ -749,7 +749,7 @@ fn const_references_not_function_with_signed_ints() { "VAR_GLOBAL CONSTANT _0x00ff : INT := 16#00FF; // 255 END_VAR - + VAR_GLOBAL CONSTANT a : INT := INT#16#55; // 85; aa : INT := WORD#16#FFAB; // 65xxx; @@ -784,7 +784,7 @@ fn const_references_to_bool_compile_time_evaluation() { y : BOOL := FALSE; z : BOOL := y; END_VAR - + VAR_GLOBAL CONSTANT a : BOOL := x; b : BOOL := y OR NOT y; @@ -863,7 +863,7 @@ fn const_string_initializers_should_be_converted() { a : STRING := 'Hello'; b : WSTRING := "World"; END_VAR - + VAR_GLOBAL CONSTANT aa : STRING := b; bb : WSTRING := a; @@ -892,7 +892,7 @@ fn const_lreal_initializers_should_be_resolved_correctly() { VAR_GLOBAL CONSTANT clreal : LREAL := 3.1415; END_VAR - + VAR_GLOBAL CONSTANT tau : LREAL := 2 * clreal; END_VAR @@ -931,7 +931,7 @@ fn array_size_from_constant() { VAR CONSTANT a : INT := 3; b : INT := 7; - END_VAR + END_VAR VAR arr : ARRAY[a..b] OF BYTE; @@ -1005,7 +1005,7 @@ fn nested_array_literals_type_resolving() { let (parse_result, mut index) = index_with_ids( r#" VAR_GLOBAL CONSTANT - a : ARRAY[0..1] OF ARRAY[0..1] OF BYTE := [[1,2],[3,4]]; + a : ARRAY[0..1] OF ARRAY[0..1] OF BYTE := [[1,2],[3,4]]; END_VAR "#, id_provider.clone(), @@ -1064,7 +1064,7 @@ fn nested_array_literals_multiplied_statement_type_resolving() { let (parse_result, mut index) = index_with_ids( r#" VAR_GLOBAL CONSTANT - a : ARRAY[0..1] OF ARRAY[0..1] OF BYTE := [[2(2)],[2(3)]]; + a : ARRAY[0..1] OF ARRAY[0..1] OF BYTE := [[2(2)],[2(3)]]; END_VAR "#, id_provider.clone(), @@ -1157,7 +1157,7 @@ fn function_block_initializers_constant_resolved_in_assignment() { END_VAR END_FUNCTION_BLOCK - PROGRAM main + PROGRAM main VAR CONSTANT TEN : INT := 10; @@ -1184,7 +1184,7 @@ fn function_block_initializers_constant_resolved_in_assignment() { fn contants_in_case_statements_resolved() { let id_provider = IdProvider::default(); let (parse_result, mut index) = index_with_ids( - " + " PROGRAM main VAR DAYS_IN_MONTH : DINT; @@ -1193,12 +1193,12 @@ fn contants_in_case_statements_resolved() { SIXTY : DINT := 60; END_VAR CASE DAYS_IN_MONTH OF - 32..SIXTY : DAYS_IN_MONTH := 29; - (SIXTY + 2)..70 : DAYS_IN_MONTH := 30; + 32..SIXTY : DAYS_IN_MONTH := 29; + (SIXTY + 2)..70 : DAYS_IN_MONTH := 30; ELSE DAYS_IN_MONTH := 31; END_CASE; - END_PROGRAM + END_PROGRAM ", id_provider.clone(), ); @@ -1220,7 +1220,7 @@ fn contants_in_case_statements_resolved() { fn default_values_are_transitive_for_range_types() { // GIVEN a range type that inherits the default value from its referenced type let src = codegen( - " + " TYPE MyINT : INT := 7; END_TYPE TYPE MyRange : MyINT(1..10); END_TYPE diff --git a/src/resolver/tests/resolve_control_statments.rs b/src/resolver/tests/resolve_control_statments.rs index c911b37417..a65ba38ebe 100644 --- a/src/resolver/tests/resolve_control_statments.rs +++ b/src/resolver/tests/resolve_control_statments.rs @@ -14,7 +14,7 @@ fn binary_expressions_resolves_types() { let (unit, index) = index_with_ids( "PROGRAM PRG VAR x : INT; END_VAR - FOR x := 3 TO 10 BY 2 DO + FOR x := 3 TO 10 BY 2 DO x; END_FOR END_PROGRAM", diff --git a/src/resolver/tests/resolve_expressions_tests.rs b/src/resolver/tests/resolve_expressions_tests.rs index 4507024011..9e40af983e 100644 --- a/src/resolver/tests/resolve_expressions_tests.rs +++ b/src/resolver/tests/resolve_expressions_tests.rs @@ -94,8 +94,8 @@ fn cast_expression_literals_get_casted_types() { let id_provider = IdProvider::default(); let (unit, mut index) = index_with_ids( "PROGRAM PRG - INT#16#FFFF; - WORD#16#FFFF; + INT#16#FFFF; + WORD#16#FFFF; END_PROGRAM", id_provider.clone(), ); @@ -1430,7 +1430,7 @@ fn alias_and_subrange_expressions_resolve_types() { TYPE MySubrange : INT(0..100); END_TYPE; PROGRAM PRG - VAR + VAR i : INT; a : MyAlias; s : MySubrange; @@ -1756,7 +1756,7 @@ fn actions_are_resolved() { prg.foo; END_PROGRAM ACTIONS prg - ACTION foo + ACTION foo END_ACTION END_ACTIONS @@ -2413,17 +2413,17 @@ fn struct_member_explicit_initialization_test() { let id_provider = IdProvider::default(); let (unit, mut index) = index_with_ids( "FUNCTION main : DINT - VAR - x : myStruct; - END_VAR - x := (var1 := 1, var2 := 7); - END_FUNCTION - - TYPE myStruct : STRUCT - var1 : DINT; - var2 : BYTE; - END_STRUCT - END_TYPE", + VAR + x : myStruct; + END_VAR + x := (var1 := 1, var2 := 7); + END_FUNCTION + + TYPE myStruct : STRUCT + var1 : DINT; + var2 : BYTE; + END_STRUCT + END_TYPE", id_provider.clone(), ); @@ -2475,7 +2475,7 @@ fn program_members_initializers_type_hint_test() { let (unit, mut index) = index_with_ids( " PROGRAM prg - VAR_INPUT + VAR_INPUT i : INT := 7; si : SINT := 7; b : BOOL := 1; @@ -3433,9 +3433,9 @@ fn call_explicit_parameter_name_is_resolved() { END_FUNCTION_BLOCK PROGRAM PRG - VAR - f : fb; - END_VAR + VAR + f : fb; + END_VAR f(b:= 1, a:= 3); END_PROGRAM ", @@ -3495,9 +3495,9 @@ fn call_on_function_block_array() { END_FUNCTION_BLOCK PROGRAM PRG - VAR - fbs : ARRAY[1..2] OF fb; - END_VAR + VAR + fbs : ARRAY[1..2] OF fb; + END_VAR fbs[1](); END_PROGRAM ", @@ -3531,9 +3531,9 @@ fn and_statement_of_bools_results_in_bool() { let (unit, index) = index_with_ids( " PROGRAM PRG - VAR + VAR a,b : BOOL; - END_VAR + END_VAR a AND b; END_PROGRAM @@ -3555,10 +3555,10 @@ fn and_statement_of_dints_results_in_dint() { let (unit, index) = index_with_ids( " PROGRAM PRG - VAR + VAR a,b : DINT; c,d : INT; - END_VAR + END_VAR a AND b; c AND d; @@ -3582,21 +3582,21 @@ fn resolve_recursive_function_call() { let (unit, index) = index_with_ids( " FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR - var1, var2, var3 : DINT; - END_VAR - foo(input1 := var1, inout1 := var2, output1 => var3, ); - foo := var1; - END_FUNCTION + VAR_INPUT + input1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR + var1, var2, var3 : DINT; + END_VAR + foo(input1 := var1, inout1 := var2, output1 => var3, ); + foo := var1; + END_FUNCTION ", id_provider.clone(), ); @@ -3630,20 +3630,20 @@ fn resolve_recursive_program_call() { let (unit, index) = index_with_ids( " PROGRAM mainProg - VAR_INPUT - input1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR - var1, var2, var3 : DINT; - END_VAR - mainProg(input1 := var1, inout1 := var2, output1 => var3, ); - END_PROGRAM + VAR_INPUT + input1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR + var1, var2, var3 : DINT; + END_VAR + mainProg(input1 := var1, inout1 := var2, output1 => var3, ); + END_PROGRAM ", id_provider.clone(), ); @@ -4098,17 +4098,17 @@ fn array_of_struct_with_initial_values_annotated_correctly() { // GIVEN let (unit, mut index) = index_with_ids( " - TYPE myStruct : STRUCT - a, b : DINT; - c : ARRAY[0..1] OF DINT; - END_STRUCT - END_TYPE - - PROGRAM main - VAR - arr : ARRAY[0..1] OF myStruct := [(a := 10, b := 20, c := [30, 40]), (a := 50, b := 60, c := [70, 80])]; - END_VAR - END_PROGRAM", + TYPE myStruct : STRUCT + a, b : DINT; + c : ARRAY[0..1] OF DINT; + END_STRUCT + END_TYPE + + PROGRAM main + VAR + arr : ARRAY[0..1] OF myStruct := [(a := 10, b := 20, c := [30, 40]), (a := 50, b := 60, c := [70, 80])]; + END_VAR + END_PROGRAM", id_provider.clone(), ); @@ -4239,18 +4239,18 @@ fn mux_generic_with_strings_is_annotated_correctly() { // GIVEN let (unit, mut index) = index_with_ids( " - PROGRAM main - VAR - str1 : STRING; - END_VAR - VAR_TEMP - str2 : STRING := 'str2 '; - str3 : STRING := 'str3 '; - str4 : STRING := 'str4 '; - END_VAR - MUX(2, str2, str3, str4); + PROGRAM main + VAR + str1 : STRING; + END_VAR + VAR_TEMP + str2 : STRING := 'str2 '; + str3 : STRING := 'str3 '; + str4 : STRING := 'str4 '; + END_VAR + MUX(2, str2, str3, str4); str2; - END_PROGRAM + END_PROGRAM ", id_provider.clone(), ); @@ -4964,8 +4964,8 @@ fn override_is_resolved() { END_CLASS FUNCTION_BLOCK fb - VAR - myClass : cls2; + VAR + myClass : cls2; END_VAR myClass.foo(); @@ -5023,8 +5023,8 @@ fn override_in_grandparent_is_resolved() { END_CLASS FUNCTION_BLOCK fb - VAR - myClass : cls2; + VAR + myClass : cls2; END_VAR myClass.foo(); @@ -5065,8 +5065,8 @@ fn annotate_variable_in_parent_class() { let (unit, index) = index_with_ids( " CLASS cls1 - VAR - LIGHT: BOOL; + VAR + LIGHT: BOOL; END_VAR END_CLASS @@ -5120,7 +5120,7 @@ fn annotate_variable_in_grandparent_class() { let (unit, index) = index_with_ids( " CLASS cls0 - VAR + VAR LIGHT: BOOL; END_VAR END_CLASS @@ -5158,7 +5158,7 @@ fn annotate_variable_in_field() { let (unit, index) = index_with_ids( " CLASS cls0 - VAR + VAR LIGHT: BOOL; END_VAR END_CLASS @@ -5170,8 +5170,8 @@ fn annotate_variable_in_field() { END_FUNCTION_BLOCK PROGRAM prog - VAR - myClass : cls2; + VAR + myClass : cls2; END_VAR myClass.LIGHT := TRUE; @@ -5203,7 +5203,7 @@ fn annotate_method_in_super() { let (unit, index) = index_with_ids( " CLASS cls0 - VAR + VAR LIGHT: BOOL; END_VAR @@ -5213,7 +5213,7 @@ fn annotate_method_in_super() { END_CLASS CLASS cls1 EXTENDS cls0 - VAR + VAR LIGHT1: BOOL; END_VAR @@ -5224,7 +5224,7 @@ fn annotate_method_in_super() { END_CLASS CLASS cls2 EXTENDS cls1 - VAR + VAR LIGHT2: BOOL; END_VAR METHOD meth2 : DINT diff --git a/src/resolver/tests/resolve_generic_calls.rs b/src/resolver/tests/resolve_generic_calls.rs index 5d1d905722..cda9f0ac68 100644 --- a/src/resolver/tests/resolve_generic_calls.rs +++ b/src/resolver/tests/resolve_generic_calls.rs @@ -512,7 +512,7 @@ fn builtin_generic_functions_do_not_get_specialized_calls() { fn builtin_adr_ref_return_annotated() { let id_provider = IdProvider::default(); let (unit, index) = index_with_ids( - "PROGRAM main + "PROGRAM main VAR_INPUT input1 : REF_TO DINT; param1 : DINT; @@ -573,7 +573,7 @@ fn resolve_variadic_generics() { let id_provider = IdProvider::default(); let (unit, index) = index_with_ids( " - FUNCTION ex : U + FUNCTION ex : U VAR_INPUT ar : {sized}U...; END_VAR @@ -613,14 +613,14 @@ fn generic_call_gets_cast_to_biggest_type() { let id_provider = IdProvider::default(); let (unit, index) = index_with_ids( r" - + {external} FUNCTION MAX : T VAR_INPUT args : {sized} T...; END_VAR END_FUNCTION - + FUNCTION main : LREAL MAX(SINT#5,DINT#1,LREAL#1.5,1.2); END_FUNCTION", @@ -694,13 +694,13 @@ fn auto_pointer_of_generic_resolved() { IN : T; END_VAR END_FUNCTION - + FUNCTION LEFT_EXT : DINT VAR_IN_OUT IN : T; END_VAR END_FUNCTION - + FUNCTION LEFT__DINT : DINT VAR_INPUT IN : DINT; @@ -731,14 +731,14 @@ fn string_ref_as_generic_resolved() { IN : T; END_VAR END_FUNCTION - + FUNCTION LEFT_EXT : DINT VAR_INPUT {ref} IN : T; END_VAR END_FUNCTION - - FUNCTION LEFT__STRING : STRING + + FUNCTION LEFT__STRING : STRING VAR_INPUT IN : STRING; END_VAR @@ -790,18 +790,18 @@ fn resolved_generic_any_real_call_with_ints_added_to_index() { PROGRAM PRG VAR a : INT; - b : UINT; + b : UINT; END_VAR myFunc(REAL#1.0); myFunc(SINT#1); myFunc(a); myFunc(DINT#1); - myFunc(LINT#1); + myFunc(LINT#1); - myFunc(USINT#1); + myFunc(USINT#1); myFunc(b); myFunc(UDINT#1); - myFunc(ULINT#1); + myFunc(ULINT#1); END_PROGRAM", id_provider.clone(), ); @@ -832,7 +832,7 @@ fn generic_string_functions_are_annotated_correctly() { FUNCTION foo : T VAR_INPUT {ref} in : T; - END_VAR + END_VAR END_FUNCTION FUNCTION foo__STRING : STRING @@ -878,7 +878,7 @@ fn generic_string_functions_are_annotated_correctly() { fn generic_string_functions_without_specific_implementation_are_annotated_correctly() { let id_provider = IdProvider::default(); let (unit, mut index) = index_with_ids( - r#" + r#" FUNCTION LEN : DINT VAR_INPUT {ref} IN : T; @@ -943,7 +943,7 @@ fn generic_string_functions_with_non_default_length_are_annotated_correctly() { FUNCTION foo : T VAR_INPUT {ref} in : T; - END_VAR + END_VAR VAR_OUTPUT {ref} out : T; END_VAR diff --git a/src/resolver/tests/resolve_literals_tests.rs b/src/resolver/tests/resolve_literals_tests.rs index 18868548fa..5997737c1e 100644 --- a/src/resolver/tests/resolve_literals_tests.rs +++ b/src/resolver/tests/resolve_literals_tests.rs @@ -114,12 +114,12 @@ fn date_literals_are_annotated() { TIME#-12m; TOD#00:00:12; TIME_OF_DAY#04:16:22; - TIME_OF_DAY#04:16; - DATE_AND_TIME#1984-10-01-16:40:22; - DT#2021-04-20-22:33:14; - DATE_AND_TIME#2000-01-01-20:15; - DATE#1984-10-01; - D#2021-04-20; + TIME_OF_DAY#04:16; + DATE_AND_TIME#1984-10-01-16:40:22; + DT#2021-04-20-22:33:14; + DATE_AND_TIME#2000-01-01-20:15; + DATE#1984-10-01; + D#2021-04-20; END_PROGRAM", id_provider.clone(), ); @@ -149,9 +149,9 @@ fn long_date_literals_are_annotated() { let (unit, index) = index_with_ids( "PROGRAM PRG LTIME#12.4d; - LDATE#1984-10-01; - LDT#1984-10-01-16:40:22; - LTOD#00:00:12; + LDATE#1984-10-01; + LDT#1984-10-01-16:40:22; + LTOD#00:00:12; END_PROGRAM", id_provider.clone(), ); @@ -222,10 +222,10 @@ fn enum_literals_are_annotated() { TYPE Color: (Green, Yellow, Red); END_TYPE TYPE Animal: (Dog, Cat, Horse); END_TYPE - VAR_GLOBAL + VAR_GLOBAL Cat : BOOL; END_VAR - + PROGRAM PRG VAR Yellow: BYTE; END_VAR @@ -462,11 +462,11 @@ fn expression_list_as_array_initilization_is_annotated_correctly() { let id_provider = IdProvider::default(); let (unit, mut index) = index_with_ids( " - VAR_GLOBAL - a : ARRAY[0..2] OF INT := 1+1,2; - b : ARRAY[0..2] OF STRING[3] := 'ABC','D'; - END_VAR - ", + VAR_GLOBAL + a : ARRAY[0..2] OF INT := 1+1,2; + b : ARRAY[0..2] OF STRING[3] := 'ABC','D'; + END_VAR + ", id_provider.clone(), ); diff --git a/src/resolver/tests/resolver_dependency_resolution.rs b/src/resolver/tests/resolver_dependency_resolution.rs index ba9546420f..f8df3a68a1 100644 --- a/src/resolver/tests/resolver_dependency_resolution.rs +++ b/src/resolver/tests/resolver_dependency_resolution.rs @@ -336,19 +336,19 @@ fn function_params_dependency_resolution() { " FUNCTION foo : BYTE VAR_INPUT - a : DINT; + a : DINT; END_VAR VAR_INPUT {ref} - b : INT; + b : INT; END_VAR VAR_IN_OUT - c : REAL; + c : REAL; END_VAR VAR_OUTPUT d : LREAL; END_VAR VAR - e : WORD; + e : WORD; END_VAR END_FUNCTION ", @@ -385,18 +385,18 @@ fn function_params_dependency_resolution() { fn program_params_dependency_resolution() { let units = [ " - PROGRAM foo + PROGRAM foo VAR_INPUT - a : DINT; + a : DINT; END_VAR VAR_IN_OUT - c : REAL; + c : REAL; END_VAR VAR_OUTPUT d : LREAL; END_VAR VAR - e : WORD; + e : WORD; END_VAR END_PROGRAM ", @@ -429,21 +429,21 @@ fn program_params_dependency_resolution() { fn function_block_params_dependency_resolution() { let units = [ " - FUNCTION_BLOCK fb + FUNCTION_BLOCK fb VAR_INPUT - a : DINT; + a : DINT; END_VAR VAR_INPUT {ref} - b : INT; + b : INT; END_VAR VAR_IN_OUT - c : REAL; + c : REAL; END_VAR VAR_OUTPUT d : LREAL; END_VAR VAR - e : WORD; + e : WORD; END_VAR END_FUNCTION_BLOCK ", diff --git a/src/tests/adr/annotated_ast_adr.rs b/src/tests/adr/annotated_ast_adr.rs index 233b563ade..bdfc003e7c 100644 --- a/src/tests/adr/annotated_ast_adr.rs +++ b/src/tests/adr/annotated_ast_adr.rs @@ -24,7 +24,7 @@ fn references_to_variables_are_annotated() { // parse and index let (statements, annotations, ..) = annotate!( r#" - PROGRAM prg + PROGRAM prg VAR a : SINT; b : SINT; @@ -74,9 +74,9 @@ fn different_types_of_annotations() { // parse and annotate the following program let (statements, annotations, ..) = annotate!( r#" - PROGRAM prg + PROGRAM prg VAR p : POINT END_VAR - + p.x; // to a variable (POINT.x) foo(); // resolves to a call p.y + foo(); // resolves to a value @@ -85,7 +85,7 @@ fn different_types_of_annotations() { FUNCTION foo : DINT END_FUNCTION - PROGRAM Main + PROGRAM Main VAR_INPUT in : INT; END_VAR END_FUNCTION @@ -182,13 +182,13 @@ fn different_types_of_annotations() { fn type_annotations_reflect_the_evaluation_result() { let (statements, annotations, idx) = annotate!( r#" - PROGRAM prg - VAR - i : INT; + PROGRAM prg + VAR + i : INT; d : DINT; l : LINT; END_VAR - + i + d; i + 3; l - d; @@ -220,12 +220,12 @@ fn type_annotations_reflect_the_evaluation_result() { fn type_annotations_indicates_necessary_casts() { let (statements, annotations, _) = annotate!( r#" - PROGRAM prg - VAR - i : INT; + PROGRAM prg + VAR + i : INT; d : DINT; END_VAR - + i := d; d := i; foo(3); @@ -270,13 +270,13 @@ fn type_annotations_indicates_necessary_casts() { fn type_annotations_for_binary_expression() { let (statements, annotations, _) = annotate!( r#" - PROGRAM prg - VAR - i : INT; + PROGRAM prg + VAR + i : INT; d : DINT; r : LREAL; END_VAR - + i + d; r / d; END_PROGRAM @@ -309,12 +309,12 @@ fn type_annotations_for_binary_expression() { fn useful_type_annotation_method() { let (statements, annotations, idx) = annotate!( r#" - PROGRAM prg - VAR - i : INT; + PROGRAM prg + VAR + i : INT; d : DINT; END_VAR - + i + d; END_PROGRAM "# diff --git a/src/tests/adr/arrays_adr.rs b/src/tests/adr/arrays_adr.rs index 7538b8a564..492a0d2a22 100644 --- a/src/tests/adr/arrays_adr.rs +++ b/src/tests/adr/arrays_adr.rs @@ -109,7 +109,7 @@ fn accessing_array_elements() { END_VAR a[2] := b[4]; - END_PROGRAM + END_PROGRAM "#; // ... both will use 0-based indexing internally, although one is 0-based and the other is 3-based diff --git a/src/tests/adr/enum_adr.rs b/src/tests/adr/enum_adr.rs index b43f7b0f3b..43aa3b68a7 100644 --- a/src/tests/adr/enum_adr.rs +++ b/src/tests/adr/enum_adr.rs @@ -102,7 +102,7 @@ fn using_enums() { let src = r#" TYPE ProcessState : (open := 1, closed := 4, idle, running); END_TYPE; - + TYPE Door : (open := 8, closed := 16); END_TYPE; diff --git a/src/tests/adr/pou_adr.rs b/src/tests/adr/pou_adr.rs index d9fd1c63b2..d5bf53649c 100644 --- a/src/tests/adr/pou_adr.rs +++ b/src/tests/adr/pou_adr.rs @@ -28,7 +28,7 @@ use crate::test_utils::tests::{annotate_with_ids, codegen, index_with_ids}; /// global variable withe the program's name. When calling a program all parameters, except IN_OUT parameters, are optional. const DEFAULT_PRG: &str = r#" - PROGRAM main_prg + PROGRAM main_prg VAR_INPUT i : INT END_VAR VAR_IN_OUT io : INT END_VAR VAR_OUTPUT o : INT; END_VAR @@ -77,11 +77,11 @@ fn programs_state_is_stored_in_a_struct() { TextLocation { line: 2, column: 20, - offset: 43, + offset: 42, }..TextLocation { line: 2, column: 21, - offset: 44, + offset: 43, }, ), }, @@ -104,11 +104,11 @@ fn programs_state_is_stored_in_a_struct() { TextLocation { line: 3, column: 20, - offset: 83, + offset: 82, }..TextLocation { line: 3, column: 22, - offset: 85, + offset: 84, }, ), }, @@ -131,11 +131,11 @@ fn programs_state_is_stored_in_a_struct() { TextLocation { line: 4, column: 20, - offset: 123, + offset: 122, }..TextLocation { line: 4, column: 21, - offset: 124, + offset: 123, }, ), }, @@ -158,11 +158,11 @@ fn programs_state_is_stored_in_a_struct() { TextLocation { line: 5, column: 20, - offset: 163, + offset: 162, }..TextLocation { line: 5, column: 21, - offset: 164, + offset: 163, }, ), }, @@ -185,11 +185,11 @@ fn programs_state_is_stored_in_a_struct() { TextLocation { line: 6, column: 20, - offset: 203, + offset: 202, }..TextLocation { line: 6, column: 22, - offset: 205, + offset: 204, }, ), }, @@ -259,7 +259,7 @@ fn calling_a_program() { r#" FUNCTION foo : INT VAR x, y : INT; END_VAR - main_prg(i := 1, io := y, o => x); + main_prg(i := 1, io := y, o => x); END_FUNCTION {DEFAULT_PRG} @@ -361,8 +361,8 @@ fn calling_a_function_block() { PROGRAM foo VAR x, y : INT; END_VAR VAR fb : main_fb; END_VAR - - fb(i := 1, io := y, o => x); + + fb(i := 1, io := y, o => x); END_PROGRAM {DEFAULT_FB} @@ -460,10 +460,10 @@ fn calling_a_function() { r#" PROGRAM prg VAR - x : INT; - z : SINT; - END_VAR - main_fun(x, z); + x : INT; + z : SINT; + END_VAR + main_fun(x, z); END_FUNCTION {DEFAULT_FUNC} @@ -526,9 +526,9 @@ fn return_a_complex_type_from_function() { PROGRAM prg VAR - s : STRING; + s : STRING; END_VAR - s := foo(); + s := foo(); END_FUNCTION "#; insta::assert_snapshot!(codegen(returning_string), @r###" @@ -594,8 +594,8 @@ fn passing_by_ref_to_functions() { // ... END_FUNCTION PROGRAM main - VAR - str1, str2 : STRING; + VAR + str1, str2 : STRING; END_VAR StrEqual(str1, str2); //looks like pass by-val END_PROGRAM diff --git a/src/tests/adr/vla_adr.rs b/src/tests/adr/vla_adr.rs index 2cfe6ce7cd..0fc8ab72cc 100644 --- a/src/tests/adr/vla_adr.rs +++ b/src/tests/adr/vla_adr.rs @@ -27,7 +27,7 @@ fn representation() { // The probably most interesting entry here is the `source` field, indicating that the given struct is a // VLA with one dimension of type DINT. - insta::assert_debug_snapshot!(index.find_effective_type_by_name("__foo_arr").unwrap(), + insta::assert_debug_snapshot!(index.find_effective_type_by_name("__foo_arr").unwrap(), @r###" DataType { name: "__foo_arr", @@ -95,7 +95,7 @@ fn representation() { "###); // Pointer to `__arr_vla_1_dint`, which translates to... - insta::assert_debug_snapshot!(index.find_effective_type_by_name("__ptr_to___arr_vla_1_dint").unwrap(), + insta::assert_debug_snapshot!(index.find_effective_type_by_name("__ptr_to___arr_vla_1_dint").unwrap(), @r###" DataType { name: "__ptr_to___arr_vla_1_dint", @@ -136,7 +136,7 @@ fn representation() { "###); // Finally the dimensions array, which is being populated at runtime; see [`pass`] - insta::assert_debug_snapshot!(index.find_effective_type_by_name("__bounds___arr_vla_1_dint").unwrap(), + insta::assert_debug_snapshot!(index.find_effective_type_by_name("__bounds___arr_vla_1_dint").unwrap(), @r###" DataType { name: "__bounds___arr_vla_1_dint", @@ -211,7 +211,7 @@ fn pass() { let (_, local) = deconstruct_call_statement!(&statements[0]); // `local` is defined as an array of type DINT... - insta::assert_debug_snapshot!(annotations.get_type(local[0], &index).unwrap(), + insta::assert_debug_snapshot!(annotations.get_type(local[0], &index).unwrap(), @r###" DataType { name: "__main_local", @@ -256,7 +256,7 @@ fn pass() { // ...but their type-hint indicates it should be VLA / fat-pointer struct. Such type-mismatches (for VLAs) // result in wrapping arrays into structs. let hint = annotations.get_type_hint(local[0], &index).unwrap(); - insta::assert_debug_snapshot!(index.find_elementary_pointer_type(&hint.information), + insta::assert_debug_snapshot!(index.find_elementary_pointer_type(&hint.information), @r###" Struct { name: "__foo_arr", @@ -309,7 +309,7 @@ fn pass() { // 1. Stack-allocate a struct // 2. GEP the structs array and dimension field // 3. Populate them based on the information we have on `local`, i.e. 1D and (start, end)-offset = (0, 5) - insta::assert_snapshot!(codegen(src), + insta::assert_snapshot!(codegen(src), @r###" ; ModuleID = 'main' source_filename = "main" @@ -375,7 +375,7 @@ fn access() { END_FUNCTION "; - insta::assert_snapshot!(codegen(src), + insta::assert_snapshot!(codegen(src), @r###" ; ModuleID = 'main' source_filename = "main" @@ -433,15 +433,15 @@ fn multi_dimensional() { // To increase readability of the generated IR, most values are named according to their purpose. // When dealing with a higher dimension-count or multiple access statements, the IR gets bloated really fast and // is borderline incomprehensible as a result, if not given readable names. - insta::assert_snapshot!(codegen(src), + insta::assert_snapshot!(codegen(src), @r###" ; ModuleID = 'main' source_filename = "main" - + %__foo_arr = type { i32*, [4 x i32] } - + @____foo_arr__init = unnamed_addr constant %__foo_arr zeroinitializer - + define i32 @foo(%__foo_arr* %0) { entry: %foo = alloca i32, align 4 diff --git a/src/validation/statement.rs b/src/validation/statement.rs index be37f3c0ff..d45b93f307 100644 --- a/src/validation/statement.rs +++ b/src/validation/statement.rs @@ -1039,7 +1039,7 @@ fn validate_type_nature( // check if type_hint and actual_type is compatible // should be handled by assignment validation if !(actual_type.has_nature(*generic_nature, context.index) - // INT parameter for REAL is allowed + // INT parameter for REAL is allowed | (type_hint.is_real() & actual_type.is_numerical())) { validator.push_diagnostic(Diagnostic::invalid_type_nature( diff --git a/src/validation/tests/array_validation_test.rs b/src/validation/tests/array_validation_test.rs index e541b62237..a56080c7b8 100644 --- a/src/validation/tests/array_validation_test.rs +++ b/src/validation/tests/array_validation_test.rs @@ -6,42 +6,42 @@ use crate::test_utils::tests::parse_and_validate_buffered; fn array_access_validation() { let diagnostics = parse_and_validate_buffered( " - VAR_GLOBAL CONSTANT - start : INT := 1; - end : INT := 2; - END_VAR - - PROGRAM prg - VAR - multi : ARRAY[0..1,2..3] OF INT; - nested : ARRAY[0..1] OF ARRAY[2..3] OF INT; - arr : ARRAY[0..1] OF INT; - negative_start : ARRAY[-2..2] OF INT; - negative : ARRAY[-3..-1] OF INT; - const : ARRAY[start..end] OF INT; - int_ref : INT; - string_ref : STRING; - END_VAR - - // valid - multi[0,3]; - nested[1][3]; - arr[1]; - negative_start[-1]; - negative[-2]; - const[1]; - arr[int_ref]; - - // invalid - multi[1,4]; // out of range - nested[1][4]; // out of range - arr[3]; // out of range - negative_start[-4]; // out of range - negative[-4]; // out of range - const[3]; // out of range - arr[string_ref]; // invalid type for array access - int_ref[1]; // not an array - END_PROGRAM + VAR_GLOBAL CONSTANT + start : INT := 1; + end : INT := 2; + END_VAR + + PROGRAM prg + VAR + multi : ARRAY[0..1,2..3] OF INT; + nested : ARRAY[0..1] OF ARRAY[2..3] OF INT; + arr : ARRAY[0..1] OF INT; + negative_start : ARRAY[-2..2] OF INT; + negative : ARRAY[-3..-1] OF INT; + const : ARRAY[start..end] OF INT; + int_ref : INT; + string_ref : STRING; + END_VAR + + // valid + multi[0,3]; + nested[1][3]; + arr[1]; + negative_start[-1]; + negative[-2]; + const[1]; + arr[int_ref]; + + // invalid + multi[1,4]; // out of range + nested[1][4]; // out of range + arr[3]; // out of range + negative_start[-4]; // out of range + negative[-4]; // out of range + const[3]; // out of range + arr[string_ref]; // invalid type for array access + int_ref[1]; // not an array + END_PROGRAM ", ); @@ -52,28 +52,28 @@ fn array_access_validation() { fn array_initialization_validation() { let diagnostics = parse_and_validate_buffered( " - FUNCTION main : DINT - VAR - arr : ARRAY[1..2] OF DINT; - arr2 : ARRAY[1..2] OF DINT := 1, 2; // Missing `[` - arr3 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := (1, 2))); // Missing `[` - arr4 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := 1, 2)); // Missing `[` - arr_init : ARRAY[1..2] OF DINT := (1, 2); // Missing `[` - x : myStruct; - y : myStruct := (var1 := 1, var2 := 3, 4); // Missing `[` - END_VAR - arr := 1, 2; // Missing `[` - arr := (1, 2); // Missing `[` - arr := (arr_init); // valid - x := (var1 := 1, var2 := 3, 4); // Missing `[` - x := (var1 := 1, var2 := arr_init); // valid - END_FUNCTION - - TYPE myStruct : STRUCT - var1 : DINT; - var2 : ARRAY[1..2] OF DINT; - END_STRUCT - END_TYPE + FUNCTION main : DINT + VAR + arr : ARRAY[1..2] OF DINT; + arr2 : ARRAY[1..2] OF DINT := 1, 2; // Missing `[` + arr3 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := (1, 2))); // Missing `[` + arr4 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := 1, 2)); // Missing `[` + arr_init : ARRAY[1..2] OF DINT := (1, 2); // Missing `[` + x : myStruct; + y : myStruct := (var1 := 1, var2 := 3, 4); // Missing `[` + END_VAR + arr := 1, 2; // Missing `[` + arr := (1, 2); // Missing `[` + arr := (arr_init); // valid + x := (var1 := 1, var2 := 3, 4); // Missing `[` + x := (var1 := 1, var2 := arr_init); // valid + END_FUNCTION + + TYPE myStruct : STRUCT + var1 : DINT; + var2 : ARRAY[1..2] OF DINT; + END_STRUCT + END_TYPE ", ); @@ -84,23 +84,23 @@ fn array_initialization_validation() { fn array_access_dimension_mismatch() { let diagnostics = parse_and_validate_buffered( " - FUNCTION fn : DINT - VAR_INPUT {ref} - arr : ARRAY[0..5] OF DINT; - vla : ARRAY[*] OF DINT; - END_VAR - - // Valid - arr[0] := 1; - vla[0] := 1; - - // Invalid - arr[0, 1] := 1; - vla[0, 1] := 1; - arr[0, 1, 2] := 1; - vla[0, 1, 2] := 1; - END_FUNCTION - ", + FUNCTION fn : DINT + VAR_INPUT {ref} + arr : ARRAY[0..5] OF DINT; + vla : ARRAY[*] OF DINT; + END_VAR + + // Valid + arr[0] := 1; + vla[0] := 1; + + // Invalid + arr[0, 1] := 1; + vla[0, 1] := 1; + arr[0, 1, 2] := 1; + vla[0, 1, 2] := 1; + END_FUNCTION + ", ); assert_snapshot!(diagnostics); @@ -110,23 +110,23 @@ fn array_access_dimension_mismatch() { fn assignment_1d() { let diagnostics = parse_and_validate_buffered( " - FUNCTION main : DINT - VAR - arr : ARRAY[1..5] OF DINT := [1, 2, 3, 4, 5, 6]; - arr_alt : ARRAY[1..5] OF DINT := (1, 2, 3, 4, 5, 6); - END_VAR - - arr := [1, 2, 3, 4]; // Valid - arr := [1, 2, 3, 4, 5]; // Valid - - arr := (1, 2, 3, 4); - arr := (1, 2, 3, 4, 5); - arr := (1, 2, 3, 4, 5, 6); - arr := [1, 2, 3, 4, 5, 6]; - arr := [1, 2, 3, 4, 5); - arr := (1, 2, 3, 4, 5]; - END_FUNCTION - ", + FUNCTION main : DINT + VAR + arr : ARRAY[1..5] OF DINT := [1, 2, 3, 4, 5, 6]; + arr_alt : ARRAY[1..5] OF DINT := (1, 2, 3, 4, 5, 6); + END_VAR + + arr := [1, 2, 3, 4]; // Valid + arr := [1, 2, 3, 4, 5]; // Valid + + arr := (1, 2, 3, 4); + arr := (1, 2, 3, 4, 5); + arr := (1, 2, 3, 4, 5, 6); + arr := [1, 2, 3, 4, 5, 6]; + arr := [1, 2, 3, 4, 5); + arr := (1, 2, 3, 4, 5]; + END_FUNCTION + ", ); assert_snapshot!(diagnostics); @@ -136,28 +136,28 @@ fn assignment_1d() { fn assignment_2d() { let diagnostics = parse_and_validate_buffered( " - FUNCTION main : DINT - VAR - arr : ARRAY[1..2, 1..5] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; - arr_alt : ARRAY[1..2, 1..5] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); - - arr_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; - arr_nested_alt : ARRAY[1..2] OF ARRAY[1..5] OF DINT := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); - END_VAR - - arr := [1, 2, 3, 4, 5, 6, 7, 8, 9]; // Valid - arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; // Valid - - arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); - arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); - arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; - - arr_nested := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10] ]; // Valid - arr_nested := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; - arr_nested := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); - END_FUNCTION - ", + FUNCTION main : DINT + VAR + arr : ARRAY[1..2, 1..5] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + arr_alt : ARRAY[1..2, 1..5] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + + arr_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; + arr_nested_alt : ARRAY[1..2] OF ARRAY[1..5] OF DINT := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); + END_VAR + + arr := [1, 2, 3, 4, 5, 6, 7, 8, 9]; // Valid + arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; // Valid + + arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); + arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + + arr_nested := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10] ]; // Valid + arr_nested := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; + arr_nested := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); + END_FUNCTION + ", ); assert_snapshot!(diagnostics); @@ -167,27 +167,27 @@ fn assignment_2d() { fn assignment_3d() { let diagnostics = parse_and_validate_buffered( " - FUNCTION main : DINT - VAR - arr : ARRAY[1..2, 1..2, 1..2] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9]; - arr_alt : ARRAY[1..2, 1..2, 1..2] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9); - - arr_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; - arr_nested_alt : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); - END_VAR - - arr := [1, 2, 3, 4, 5, 6, 7]; // Valid - arr := [1, 2, 3, 4, 5, 6, 7, 8]; // Valid - - arr := (1, 2, 3, 4, 5, 6, 7, 8); - arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); - arr := [1, 2, 3, 4, 5, 6, 7, 8, 9]; - - arr_nested := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]; // Valid - arr_nested := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; - arr_nested := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); - END_FUNCTION - ", + FUNCTION main : DINT + VAR + arr : ARRAY[1..2, 1..2, 1..2] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9]; + arr_alt : ARRAY[1..2, 1..2, 1..2] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9); + + arr_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; + arr_nested_alt : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); + END_VAR + + arr := [1, 2, 3, 4, 5, 6, 7]; // Valid + arr := [1, 2, 3, 4, 5, 6, 7, 8]; // Valid + + arr := (1, 2, 3, 4, 5, 6, 7, 8); + arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); + arr := [1, 2, 3, 4, 5, 6, 7, 8, 9]; + + arr_nested := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]] ]; // Valid + arr_nested := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; + arr_nested := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); + END_FUNCTION + ", ); assert_snapshot!(diagnostics); @@ -197,27 +197,27 @@ fn assignment_3d() { fn assignment_structs() { let diagnostics = parse_and_validate_buffered( " - TYPE FOO : STRUCT - idx : DINT; - arr : ARRAY[1..2] OF BAR; - END_STRUCT END_TYPE - - TYPE BAR : STRUCT - arr : ARRAY[1..5] OF DINT; - END_STRUCT END_TYPE - - FUNCTION main : DINT - VAR - foo_valid_0 : FOO := (idx := 0, arr := [(arr := [1, 2, 3, 4, 5])]); - foo_valid_1 : FOO := (idx := 0, arr := [(arr := [1, 2, 3, 4, 5]), (arr := [1, 2, 3])]); - foo_valid_2 : FOO := (idx := 0, arr := [(arr := [1, 2, 3, 4, 5]), (arr := [1, 2, 3, 4, 5])]); - foo_valid_3 : FOO := (arr := [(arr := [1, 2, 3, 4, 5]), (arr := [1, 2, 3, 4, 5])], idx := 0); - - foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - END_VAR - END_FUNCTION - ", + TYPE FOO : STRUCT + idx : DINT; + arr : ARRAY[1..2] OF BAR; + END_STRUCT END_TYPE + + TYPE BAR : STRUCT + arr : ARRAY[1..5] OF DINT; + END_STRUCT END_TYPE + + FUNCTION main : DINT + VAR + foo_valid_0 : FOO := (idx := 0, arr := [(arr := [1, 2, 3, 4, 5])]); + foo_valid_1 : FOO := (idx := 0, arr := [(arr := [1, 2, 3, 4, 5]), (arr := [1, 2, 3])]); + foo_valid_2 : FOO := (idx := 0, arr := [(arr := [1, 2, 3, 4, 5]), (arr := [1, 2, 3, 4, 5])]); + foo_valid_3 : FOO := (arr := [(arr := [1, 2, 3, 4, 5]), (arr := [1, 2, 3, 4, 5])], idx := 0); + + foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + END_VAR + END_FUNCTION + ", ); assert_snapshot!(diagnostics); @@ -228,35 +228,35 @@ fn assignment_structs() { fn exceeding_size_structs() { let diagnostics = parse_and_validate_buffered( " - TYPE Foo : STRUCT - idx: DINT; - arr : ARRAY[1..2] OF Bar; - END_STRUCT END_TYPE - - TYPE Bar : STRUCT - arr : ARRAY[1..2] OF DINT; - END_STRUCT END_TYPE - - FUNCTION main : DINT - VAR - arr_a : Foo := ( - idx := 1, - arr := [(arr := [1, 2]), (arr := [3, 4]), (arr := [5, 6])] // Invalid, because the outter `arr` can only store 2 elements - ); - - arr_b : ARRAY[1..2] OF Foo := ( - [idx := 2, arr := [(arr := [1, 2, 3]), (arr := [4, 5])]], // Invalid because of the first inner `arr` - [idx := 3, arr := [(arr := [1, 2]), (arr := [3, 4, 5])]], // Invalid because of the second inner `arr` - ); - - arr_c : ARRAY[1..2] OF Foo := ( // Invalid because only 2 elements can be stored, but 3 are provided - (idx := 4, arr := [(arr := [1, 2, 3]), (arr := [4, 5])]), // Invalid because of the first inner `arr` - (idx := 5, arr := [(arr := [1, 2]), (arr := [3, 4, 5])]), // Invalid because of the second inner `arr` - (idx := 6, arr := [(arr := 2(0)), (arr := 4(0))]), // Invalid ebcause of the second inner `arr` - ); - END_VAR - END_FUNCTION - ", + TYPE Foo : STRUCT + idx: DINT; + arr : ARRAY[1..2] OF Bar; + END_STRUCT END_TYPE + + TYPE Bar : STRUCT + arr : ARRAY[1..2] OF DINT; + END_STRUCT END_TYPE + + FUNCTION main : DINT + VAR + arr_a : Foo := ( + idx := 1, + arr := [(arr := [1, 2]), (arr := [3, 4]), (arr := [5, 6])] // Invalid, because the outter `arr` can only store 2 elements + ); + + arr_b : ARRAY[1..2] OF Foo := ( + [idx := 2, arr := [(arr := [1, 2, 3]), (arr := [4, 5])]], // Invalid because of the first inner `arr` + [idx := 3, arr := [(arr := [1, 2]), (arr := [3, 4, 5])]], // Invalid because of the second inner `arr` + ); + + arr_c : ARRAY[1..2] OF Foo := ( // Invalid because only 2 elements can be stored, but 3 are provided + (idx := 4, arr := [(arr := [1, 2, 3]), (arr := [4, 5])]), // Invalid because of the first inner `arr` + (idx := 5, arr := [(arr := [1, 2]), (arr := [3, 4, 5])]), // Invalid because of the second inner `arr` + (idx := 6, arr := [(arr := 2(0)), (arr := 4(0))]), // Invalid ebcause of the second inner `arr` + ); + END_VAR + END_FUNCTION + ", ); assert_snapshot!(diagnostics) @@ -266,32 +266,32 @@ fn exceeding_size_structs() { fn assignment_multiplied_statement() { let diagnostics = parse_and_validate_buffered( " - FUNCTION main : DINT - VAR - arr_1d : ARRAY[1..5] OF DINT := [6(0)]; - - arr_2d : ARRAY[1..2, 1..5] OF DINT := [11(0)]; - arr_2d_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [11(0)]; - - arr_3d : ARRAY[1..2, 1..2, 1..2] OF DINT := [9(0)]; - arr_3d_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [9(0)]; - END_VAR - - // Valid - arr_1d := [5(0)]; - arr_2d := [10(0)]; - arr_2d_nested := [10(0)]; - arr_3d = [8(0)]; - arr_3d_nested := [8(0)]; - - // Invalid - arr_1d := [6(0)]; - arr_2d := [11(0)]; - arr_2d_nested := [11(0)]; - arr_3d := [9(0)]; - arr_3d_nested := [9(0)]; - END_FUNCTION - ", + FUNCTION main : DINT + VAR + arr_1d : ARRAY[1..5] OF DINT := [6(0)]; + + arr_2d : ARRAY[1..2, 1..5] OF DINT := [11(0)]; + arr_2d_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [11(0)]; + + arr_3d : ARRAY[1..2, 1..2, 1..2] OF DINT := [9(0)]; + arr_3d_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [9(0)]; + END_VAR + + // Valid + arr_1d := [5(0)]; + arr_2d := [10(0)]; + arr_2d_nested := [10(0)]; + arr_3d = [8(0)]; + arr_3d_nested := [8(0)]; + + // Invalid + arr_1d := [6(0)]; + arr_2d := [11(0)]; + arr_2d_nested := [11(0)]; + arr_3d := [9(0)]; + arr_3d_nested := [9(0)]; + END_FUNCTION + ", ); assert_snapshot!(diagnostics); diff --git a/src/validation/tests/assignment_validation_tests.rs b/src/validation/tests/assignment_validation_tests.rs index 161b365329..634a7eb857 100644 --- a/src/validation/tests/assignment_validation_tests.rs +++ b/src/validation/tests/assignment_validation_tests.rs @@ -8,7 +8,7 @@ fn constant_assignment_validation() { VAR_GLOBAL CONSTANT v_global : BOOL; END_VAR - + FUNCTION main : DINT // CONSTANT assignment v_global := TRUE; // INVALID @@ -27,26 +27,26 @@ fn real_assignment_validation() { VAR v_real : REAL; v_lreal : LREAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; - + v_word : WORD; - + v_string : STRING; - + v_char : CHAR; - + v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_3 : ARRAY[0..3] OF INT; - + v_arr_string_3 : ARRAY[0..3] OF STRING; END_VAR // REAL @@ -85,29 +85,29 @@ fn int_assignment_validation() { FUNCTION main : DINT VAR v_lreal : LREAL; - + v_udint : UDINT; v_ulint : ULINT; - + v_dint : DINT; v_lint : LINT; - + v_time : TIME; v_ltime : LTIME; - + v_word : WORD; - + v_string : STRING; - + v_char : CHAR; - + v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_3 : ARRAY[0..3] OF INT; - + v_arr_string_3 : ARRAY[0..3] OF STRING; END_VAR // UNSIGNED @@ -132,7 +132,7 @@ fn int_assignment_validation() { v_udint := v_ptr_string^; // INVALID v_udint := v_arr_int_3[0]; // valid v_udint := v_arr_string_3[0]; // INVALID - + // SIGNED v_dint := v_lreal; // valid v_dint := REAL#2.0; // valid @@ -169,25 +169,25 @@ fn duration_assignment_validation() { FUNCTION main : DINT VAR v_lreal : LREAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; v_ltime : LTIME; - + v_word : WORD; - + v_string : STRING; - + v_char : CHAR; - + v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_3 : ARRAY[0..3] OF INT; v_arr_string_3 : ARRAY[0..3] OF STRING; @@ -228,25 +228,25 @@ fn bit_assignment_validation() { FUNCTION main : DINT VAR v_lreal : LREAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; - + v_byte : BYTE; v_word : WORD; - + v_string : STRING; - + v_char : CHAR; v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_3 : ARRAY[0..3] OF INT; v_arr_string_3 : ARRAY[0..3] OF STRING; @@ -287,29 +287,29 @@ fn string_assignment_validation() { FUNCTION main : DINT VAR v_lreal : LREAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; - + v_word : WORD; - + v_string : STRING; v_str : STRING; v_string1 : STRING[1]; v_wstring : WSTRING; - + v_char : CHAR; - + v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_3 : ARRAY[0..3] OF INT; - + v_arr_string_3 : ARRAY[0..3] OF STRING; END_VAR // STRING @@ -351,30 +351,30 @@ fn char_assignment_validation() { FUNCTION main : DINT VAR v_lreal : LREAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; - + v_word : WORD; - + v_string : STRING; v_str : STRING; v_string1 : STRING[1]; v_wstring : WSTRING; - + v_char : CHAR; v_wchar : WCHAR; - + v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_3 : ARRAY[0..3] OF INT; - + v_arr_string_3 : ARRAY[0..3] OF STRING; END_VAR // CHAR @@ -419,27 +419,27 @@ fn date_assignment_validation() { FUNCTION main : DINT VAR v_lreal : LREAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; - + v_word : WORD; - + v_string : STRING; - + v_char : CHAR; - + v_date : DATE; v_tod : TOD; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; v_arr_int_3 : ARRAY[0..3] OF INT; - + v_arr_string_3 : ARRAY[0..3] OF STRING; END_VAR // DATE @@ -478,26 +478,26 @@ fn pointer_assignment_validation() { FUNCTION main : DINT VAR v_real : REAL; - + v_udint : UDINT; - + v_dint : DINT; - + v_time : TIME; - + v_word : WORD; v_lword : LWORD; - + v_string : STRING; - + v_char : CHAR; - + v_date : DATE; v_ptr_int : REF_TO INT; - + v_arr_int_3 : ARRAY[0..3] OF INT; - + v_arr_string_3 : ARRAY[0..3] OF STRING; END_VAR // POINTER @@ -536,27 +536,27 @@ fn array_assignment_validation() { FUNCTION main : DINT VAR v_real : REAL; - + v_dint : DINT; - + v_string : STRING; - + v_char : CHAR; - + v_ptr_int : REF_TO INT; v_ptr_string : REF_TO STRING; - + v_arr_int_2 : ARRAY[0..2] OF INT; v_arr_int_3 : ARRAY[0..3] OF INT; v_arr_int_4 : ARRAY[0..4] OF INT; - + v_arr_real_3 : ARRAY[0..3] OF REAL; - + v_arr_string_3 : ARRAY[0..3] OF STRING; v_arr_sized_string : ARRAY[0..3] OF STRING[256]; v_arr_sized_string1 : ARRAY[0..3] OF STRING[256]; v_arr_sized_string2 : ARRAY[0..8] OF STRING[1256]; - + v_arr_char_3 : ARRAY[0..3] OF CHAR; END_VAR // ARRAY @@ -615,19 +615,19 @@ fn struct_assignment_validation() { END_TYPE FUNCTION_BLOCK fb - VAR_IN_OUT - var_inout_struct1 : STRUCT1; - END_VAR + VAR_IN_OUT + var_inout_struct1 : STRUCT1; + END_VAR END_FUNCTION_BLOCK - + FUNCTION main : DINT VAR v_real : REAL; - + v_string : STRING; - + v_char : CHAR; - + v_struct1 : STRUCT1; v_struct1_2 : STRUCT1; v_ref_to_struct1 : REF_TO STRUCT1; @@ -655,15 +655,15 @@ fn struct_assignment_validation() { v_ref_to_struct1 := REF(v_struct1); // valid v_ref_to_struct1 := ADR(v_struct1); // valid v_ref_to_struct1 := &(v_struct1); // valid - + v_ref_to_struct1 := ADR(v_real); // valid v_ref_to_struct1 := ADR(v_string); // valid v_ref_to_struct1 := ADR(v_char); // valid - + v_ref_to_struct1 := REF(v_real); // INVALID v_ref_to_struct1 := REF(v_string); // INVALID v_ref_to_struct1 := REF(v_char); // INVALID - + v_ref_to_struct1 := &(v_real); // INVALID v_ref_to_struct1 := &(v_string); // INVALID v_ref_to_struct1 := &(v_char); // INVALID @@ -706,13 +706,13 @@ fn invalid_action_call_assignments_are_validated() { in2 : STRING; END_VAR VAR_IN_OUT - auto : WSTRING; + auto : WSTRING; END_VAR VAR_OUTPUT out : ARRAY[0..10] OF WSTRING; END_VAR END_FUNCTION_BLOCK - + ACTIONS fb_t ACTION foo END_ACTION @@ -741,13 +741,13 @@ fn implicit_invalid_action_call_assignments_are_validated() { VAR var1 : ARRAY[0..10] OF WSTRING; var2 : ARRAY[0..10] OF WSTRING; - END_VAR + END_VAR VAR_INPUT in1 : DINT; in2 : STRING; - END_VAR + END_VAR END_FUNCTION_BLOCK - + ACTIONS fb_t ACTION foo END_ACTION @@ -775,10 +775,10 @@ fn invalid_method_call_assignments_are_validated() { VAR x : INT := 10; END_VAR - + METHOD foo : DINT - VAR_INPUT - a : DINT; + VAR_INPUT + a : DINT; b : STRING; END_VAR foo := a + x; @@ -809,7 +809,7 @@ fn invalid_function_block_instantiation_is_validated() { arr_32 : ARRAY[0..1] OF DINT; END_VAR END_FUNCTION_BLOCK - + PROGRAM prog VAR s : STRING := 'HELLO'; @@ -832,14 +832,14 @@ fn implicit_action_downcasts_are_validated() { VAR var1 : ARRAY[0..10] OF WSTRING; var2 : ARRAY[0..10] OF WSTRING; - END_VAR + END_VAR VAR_INPUT in1 : DINT; in2 : DWORD; in3 : BYTE; - END_VAR + END_VAR END_FUNCTION_BLOCK - + ACTIONS fb_t ACTION foo END_ACTION @@ -905,7 +905,7 @@ fn enum_variants_mismatch() { let diagnostics = parse_and_validate( " TYPE Animal: (Dog, Cat, Horse); END_TYPE - + PROGRAM main VAR color: (red, green, blue); diff --git a/src/validation/tests/bitaccess_validation_test.rs b/src/validation/tests/bitaccess_validation_test.rs index 953e0d6d47..fbfb4d0cba 100644 --- a/src/validation/tests/bitaccess_validation_test.rs +++ b/src/validation/tests/bitaccess_validation_test.rs @@ -5,7 +5,7 @@ fn bitaccess_only_on_bit_types() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR invalid : BOOL; invalid2 : STRING; valid : BYTE; @@ -31,7 +31,7 @@ fn byteaccess_only_on_bigger_sizes() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR invalid : BYTE; invalid2 : SINT; invalid3 : USINT; @@ -54,7 +54,7 @@ fn wordaccess_only_on_bigger_sizes() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR invalid : WORD; invalid2 : INT; invalid3 : UINT; @@ -77,7 +77,7 @@ fn dwordaccess_only_on_bigger_sizes() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR invalid : DWORD; invalid2 : DINT; invalid3 : UDINT; @@ -100,7 +100,7 @@ fn bitaccess_range_test() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR a : BYTE; b : WORD; c : DWORD; d : LWORD; END_VAR a.8; @@ -119,7 +119,7 @@ fn byteaccess_range_test() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR b : WORD; c : DWORD; d : LWORD; END_VAR b.%B2; @@ -137,7 +137,7 @@ fn wordaccess_range_test() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR c : DWORD; d : LWORD; END_VAR c.%W2; @@ -154,7 +154,7 @@ fn dwordaccess_range_test() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR d : LWORD; END_VAR d.%D2; @@ -170,7 +170,7 @@ fn reference_direct_access_only_with_ints() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR c : DWORD; d : INT; e : LREAL; f : REAL; END_VAR c.%Xd; diff --git a/src/validation/tests/duplicates_validation_test.rs b/src/validation/tests/duplicates_validation_test.rs index 64f52c1ba6..a4305485b6 100644 --- a/src/validation/tests/duplicates_validation_test.rs +++ b/src/validation/tests/duplicates_validation_test.rs @@ -74,7 +74,7 @@ fn duplicate_global_variables() { VAR_GLOBAL a: BOOL; END_VAR - + "#, ); // THEN there should be 0 duplication diagnostics @@ -190,7 +190,7 @@ fn duplicate_action_should_be_a_problem() { END_VAR END_PROGRAM - ACTIONS + ACTIONS ACTION foo x := 2; END_ACTION @@ -220,14 +220,14 @@ fn duplicate_actions_in_different_pous_are_no_issue() { PROGRAM prg END_PROGRAM - ACTIONS + ACTIONS ACTION foo END_ACTION END_ACTIONS PROGRAM prg2 END_PROGRAM - ACTIONS + ACTIONS ACTION foo END_ACTION END_ACTIONS "#, diff --git a/src/validation/tests/generic_validation_tests.rs b/src/validation/tests/generic_validation_tests.rs index 128d2b5e16..4660c7f5c1 100644 --- a/src/validation/tests/generic_validation_tests.rs +++ b/src/validation/tests/generic_validation_tests.rs @@ -8,12 +8,12 @@ fn any_allows_all_natures() { FUNCTION func1 : INT VAR x : REAL; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION FUNCTION func3 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION FUNCTION func5 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : STRING; END_VAR test(x); END_FUNCTION FUNCTION func7 : INT VAR x : WSTRING; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func9 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION + FUNCTION func9 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION FUNCTION func10 : INT VAR x : str; END_VAR test(x); END_FUNCTION "; @@ -81,7 +81,7 @@ fn any_magnitude_allows_ints() { FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION FUNCTION func7 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION FUNCTION func8 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION @@ -109,9 +109,9 @@ fn any_magnitude_does_not_allow_bits() { FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -148,9 +148,9 @@ fn any_magnitude_does_not_allow_date() { FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -206,7 +206,7 @@ fn any_num_allows_ints() { FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION FUNCTION func7 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION FUNCTION func8 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION @@ -234,9 +234,9 @@ fn any_num_does_not_allow_bits() { FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -273,9 +273,9 @@ fn any_num_does_not_allow_date() { FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -330,13 +330,13 @@ fn any_real_allows_ints() { FUNCTION func1 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -348,7 +348,7 @@ fn any_real_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -360,10 +360,10 @@ fn any_real_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -375,7 +375,7 @@ fn any_real_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -399,10 +399,10 @@ fn any_real_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -456,13 +456,13 @@ fn any_int_allows_ints() { FUNCTION func1 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -474,7 +474,7 @@ fn any_int_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -486,10 +486,10 @@ fn any_int_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -501,7 +501,7 @@ fn any_int_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -525,10 +525,10 @@ fn any_int_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -581,8 +581,8 @@ fn any_unsigned_allows_unsigned_ints() { FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -593,10 +593,10 @@ fn any_unsigned_allows_unsigned_ints() { fn any_unsigned_does_not_allow_signed_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -608,7 +608,7 @@ fn any_unsigned_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -620,10 +620,10 @@ fn any_unsigned_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -635,7 +635,7 @@ fn any_unsigned_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -659,10 +659,10 @@ fn any_unsigned_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -715,8 +715,8 @@ fn any_signed_allows_signed_ints() { FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -727,10 +727,10 @@ fn any_signed_allows_signed_ints() { fn any_signed_does_not_allow_unsigned_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -742,7 +742,7 @@ fn any_signed_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -754,10 +754,10 @@ fn any_signed_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -769,7 +769,7 @@ fn any_signed_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -793,10 +793,10 @@ fn any_signed_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -848,15 +848,15 @@ fn any_duration_does_not_allow_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -868,7 +868,7 @@ fn any_duration_allows_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -880,10 +880,10 @@ fn any_duration_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -895,7 +895,7 @@ fn any_duration_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -919,10 +919,10 @@ fn any_duration_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -974,15 +974,15 @@ fn any_bit_does_not_allow_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -994,7 +994,7 @@ fn any_bit_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1006,12 +1006,12 @@ fn any_bit_allows_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION // binary expressions - FUNCTION func6 : INT + FUNCTION func6 : INT VAR a : BOOL; b : BYTE; @@ -1035,7 +1035,7 @@ fn any_bit_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1059,10 +1059,10 @@ fn any_bit_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1114,15 +1114,15 @@ fn any_chars_does_not_allow_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1134,7 +1134,7 @@ fn any_chars_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1146,10 +1146,10 @@ fn any_chars_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1161,7 +1161,7 @@ fn any_chars_allows_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1185,10 +1185,10 @@ fn any_chars_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1240,15 +1240,15 @@ fn any_string_does_not_allow_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1260,7 +1260,7 @@ fn any_string_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1272,10 +1272,10 @@ fn any_string_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1287,7 +1287,7 @@ fn any_string_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1311,10 +1311,10 @@ fn any_string_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1366,15 +1366,15 @@ fn any_char_does_not_allow_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1386,7 +1386,7 @@ fn any_char_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1398,10 +1398,10 @@ fn any_char_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1413,7 +1413,7 @@ fn any_char_allows_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1437,10 +1437,10 @@ fn any_char_does_not_allow_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1492,15 +1492,15 @@ fn any_date_does_not_allow_ints() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION - FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION + FUNCTION func1 : INT VAR x : USINT; END_VAR test(x); END_FUNCTION FUNCTION func2 : INT VAR x : UINT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : UDINT; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : ULINT; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : SINT; END_VAR test(x); END_FUNCTION FUNCTION func6 : INT VAR x : INT; END_VAR test(x); END_FUNCTION - FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION - FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION + FUNCTION func7 : INT VAR x : DINT; END_VAR test(x); END_FUNCTION + FUNCTION func8 : INT VAR x : LINT; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1512,7 +1512,7 @@ fn any_date_does_not_allow_time() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : TIME; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LTIME; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1524,10 +1524,10 @@ fn any_date_does_not_allow_bits() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : BOOL; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : BYTE; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : WORD; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : DWORD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LWORD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1539,7 +1539,7 @@ fn any_date_does_not_allow_chars() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : CHAR; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : WCHAR; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); @@ -1563,10 +1563,10 @@ fn any_date_allows_date() { let src = r" FUNCTION test : INT VAR_INPUT x : T; END_VAR END_FUNCTION FUNCTION func1 : INT VAR x : DT; END_VAR test(x); END_FUNCTION - FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION - FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION - FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION - FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION + FUNCTION func2 : INT VAR x : LDT; END_VAR test(x); END_FUNCTION + FUNCTION func3 : INT VAR x : DATE; END_VAR test(x); END_FUNCTION + FUNCTION func4 : INT VAR x : TOD; END_VAR test(x); END_FUNCTION + FUNCTION func5 : INT VAR x : LTOD; END_VAR test(x); END_FUNCTION "; let diagnostics = parse_and_validate(src); diff --git a/src/validation/tests/literals_validation_tests.rs b/src/validation/tests/literals_validation_tests.rs index 7d2346df3f..62069e2905 100644 --- a/src/validation/tests/literals_validation_tests.rs +++ b/src/validation/tests/literals_validation_tests.rs @@ -49,7 +49,7 @@ fn string_literal_casts_are_validated() { let diagnostics = parse_and_validate( r#" PROGRAM prg - + STRING#"TRUE"; WSTRING#'TRUE'; @@ -75,7 +75,7 @@ fn real_literal_casts_are_validated() { let diagnostics = parse_and_validate( r#" PROGRAM prg - + REAL#3.14; LREAL#3.15; REAL#10; @@ -84,7 +84,7 @@ fn real_literal_casts_are_validated() { REAL#TRUE; REAL#1; REAL#'3.14'; - + LREAL#TRUE; LREAL#1; LREAL#"3.14"; @@ -98,10 +98,10 @@ fn real_literal_casts_are_validated() { #[test] fn literal_cast_with_non_literal() { let diagnostics = parse_and_validate( - "PROGRAM exp - INT#[x]; + "PROGRAM exp + INT#[x]; END_PROGRAM - + VAR_GLOBAL x : INT; END_VAR", ); assert_validation_snapshot!(&diagnostics); @@ -113,10 +113,10 @@ fn literal_enum_elements_validate_without_errors() { " TYPE Animal: (Dog, Cat, Horse); END_TYPE TYPE Color: (Red, Yellow, Green); END_TYPE - - PROGRAM exp - Animal#Dog; - Color#Yellow; + + PROGRAM exp + Animal#Dog; + Color#Yellow; END_PROGRAM", ); @@ -155,12 +155,12 @@ fn char_cast_validate() { let diagnostics = parse_and_validate( r#" PROGRAM prg - + CHAR#"A"; WCHAR#'B'; - CHAR#"XY"; - WCHAR#'YZ'; + CHAR#"XY"; + WCHAR#'YZ'; END_PROGRAM "#, diff --git a/src/validation/tests/pou_validation_tests.rs b/src/validation/tests/pou_validation_tests.rs index 27ee808e09..c769b59f01 100644 --- a/src/validation/tests/pou_validation_tests.rs +++ b/src/validation/tests/pou_validation_tests.rs @@ -24,8 +24,8 @@ fn class_has_implementation() { // WHEN parse_and_validate is done let diagnostics = parse_and_validate( " - CLASS myCLASS - VAR + CLASS myCLASS + VAR LIGHT: BOOL; END_VAR LIGHT := TRUE; @@ -46,7 +46,7 @@ fn program_has_super_class() { END_CLASS PROGRAM prog EXTENDS cls - END_PROGRAM + END_PROGRAM ", ); // THEN there should be one diagnostic -> Program cannot have super class @@ -63,7 +63,7 @@ fn function_has_super_class() { END_CLASS FUNCTION func EXTENDS cls - END_FUNCTION + END_FUNCTION ", ); // THEN there should be one diagnostic -> Function cannot have super class @@ -193,19 +193,19 @@ fn in_out_variable_out_of_order() { fb.foo(myOtherInOut := out2, myInOut := out1); // valid END_PROGRAM - + FUNCTION_BLOCK fb_t VAR - myVar : BOOL; + myVar : BOOL; END_VAR VAR_INPUT - myInput : USINT; + myInput : USINT; END_VAR VAR_IN_OUT - myInOut : BOOL; + myInOut : BOOL; END_VAR VAR_OUTPUT - myOut : BOOL; + myOut : BOOL; END_VAR VAR_IN_OUT myOtherInOut : BOOL; diff --git a/src/validation/tests/recursive_validation_tests.rs b/src/validation/tests/recursive_validation_tests.rs index 02a6972194..2efa35ee9a 100644 --- a/src/validation/tests/recursive_validation_tests.rs +++ b/src/validation/tests/recursive_validation_tests.rs @@ -120,7 +120,7 @@ mod structs { a : A; e : e; END_STRUCT END_TYPE - + TYPE E : STRUCT a_int: INT; END_STRUCT END_TYPE @@ -182,11 +182,11 @@ mod structs { TYPE A : STRUCT b : B; END_STRUCT END_TYPE - + TYPE B : STRUCT c : C; END_STRUCT END_TYPE - + TYPE C : STRUCT b : B; END_STRUCT END_TYPE @@ -200,13 +200,13 @@ mod structs { fn one_cycle_with_multiple_identical_members_aba() { let diagnostics = parse_and_validate( " - TYPE A : STRUCT + TYPE A : STRUCT b1 : B; b2 : B; b3 : B; END_STRUCT END_TYPE - TYPE B : STRUCT + TYPE B : STRUCT a : A; END_STRUCT END_TYPE ", @@ -223,7 +223,7 @@ mod structs { a : A; b : B; END_STRUCT END_TYPE - + TYPE B : STRUCT a : A; END_STRUCT END_TYPE @@ -240,16 +240,16 @@ mod structs { TYPE A : STRUCT b : B; END_STRUCT END_TYPE - + TYPE B : STRUCT c : C; END_STRUCT END_TYPE - + TYPE C : STRUCT c : C; e : E; END_STRUCT END_TYPE - + TYPE E : STRUCT c : C; END_STRUCT END_TYPE @@ -314,7 +314,7 @@ mod arrays { a : ARRAY[0..1] OF A; b : ARRAY[0..1] OF B; END_STRUCT END_TYPE - + TYPE B : STRUCT a : A; END_STRUCT END_TYPE @@ -331,11 +331,11 @@ mod arrays { TYPE A : STRUCT b : ARRAY[0..1] OF B; END_STRUCT END_TYPE - + TYPE B : STRUCT c : ARRAY[0..1] OF C; END_STRUCT END_TYPE - + TYPE C : STRUCT b : ARRAY[0..1] OF B; END_STRUCT END_TYPE @@ -349,13 +349,13 @@ mod arrays { fn one_cycle_with_multiple_identical_members_aba() { let diagnostics = parse_and_validate( " - TYPE A : STRUCT + TYPE A : STRUCT b1 : ARRAY[0..1] OF B; b2 : ARRAY[0..1] OF B; b3 : ARRAY[0..1] OF B; END_STRUCT END_TYPE - TYPE B : STRUCT + TYPE B : STRUCT a : A; END_STRUCT END_TYPE ", @@ -425,18 +425,18 @@ mod arrays { TYPE E : STRUCT f : ARRAY [0..1] OF F; END_STRUCT END_TYPE - + FUNCTION_BLOCK F VAR_INPUT g : G; b : B; END_VAR END_FUNCTION_BLOCK - + TYPE G : STRUCT h : H; END_STRUCT END_TYPE - + FUNCTION_BLOCK H VAR_INPUT i : I; @@ -572,20 +572,20 @@ mod functionblocks { f : F; END_VAR END_FUNCTION_BLOCK - + FUNCTION_BLOCK F VAR_INPUT g : G; b : B; END_VAR END_FUNCTION_BLOCK - + FUNCTION_BLOCK G VAR_INPUT h : H; END_VAR END_FUNCTION_BLOCK - + FUNCTION_BLOCK H VAR_INPUT i : I; @@ -669,18 +669,18 @@ mod mixed_structs_and_functionblocks { TYPE E : STRUCT f : F; END_STRUCT END_TYPE - + FUNCTION_BLOCK F VAR_INPUT g : G; b : B; END_VAR END_FUNCTION_BLOCK - + TYPE G : STRUCT h : H; END_STRUCT END_TYPE - + FUNCTION_BLOCK H VAR_INPUT i : I; diff --git a/src/validation/tests/reference_resolve_tests.rs b/src/validation/tests/reference_resolve_tests.rs index b97c03aca4..646afe2970 100644 --- a/src/validation/tests/reference_resolve_tests.rs +++ b/src/validation/tests/reference_resolve_tests.rs @@ -62,7 +62,7 @@ fn resole_struct_member_access() { subfield3: INT; END_STRUCT END_TYPE - + TYPE MyStruct: STRUCT field1: INT; field2: INT; @@ -72,8 +72,8 @@ fn resole_struct_member_access() { END_TYPE PROGRAM prg - VAR - a : INT; + VAR + a : INT; s : MyStruct; END_VAR (* should be fine *) @@ -85,7 +85,7 @@ fn resole_struct_member_access() { s.field10; s.field20; s.field30; - + (* should be fine*) s.sub.subfield1; s.sub.subfield2; @@ -115,7 +115,7 @@ fn resolve_function_block_calls_field_access() { END_FUNCTION_BLOCK PROGRAM prg - VAR + VAR s : FB; END_VAR s; @@ -150,9 +150,9 @@ fn resolve_function_block_calls_in_structs_and_field_access() { fb2: FB; END_STRUCT END_TYPE - + PROGRAM prg - VAR + VAR s : MyStruct; END_VAR @@ -176,7 +176,7 @@ fn resolve_function_members_via_qualifier() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR s : MyStruct; END_VAR foo(a := 1, b := 2, c := 3); (* ok *) @@ -202,7 +202,7 @@ fn reference_to_private_variable_is_illegal() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR s : INT; END_VAR END_PROGRAM @@ -233,7 +233,7 @@ fn reference_to_private_variable_in_intermediate_fb() { FUNCTION_BLOCK fb2 VAR_INPUT - x : INT; + x : INT; END_VAR END_FUNCTION_BLOCK @@ -257,7 +257,7 @@ fn program_vars_are_allowed_in_their_actions() { let diagnostics = parse_and_validate( " PROGRAM prg - VAR + VAR s : INT; END_VAR END_PROGRAM @@ -276,7 +276,7 @@ fn program_vars_are_allowed_in_their_actions() { fn fb_pointer_access_call_statement_resolves_without_validation_errors() { let diagnostics = parse_and_validate( " - PROGRAM main + PROGRAM main VAR FileOpen : REF_TO file; END_VAR @@ -303,7 +303,7 @@ fn fb_pointer_access_call_statement_resolves_without_validation_errors() { fn resolve_array_of_struct_as_member_of_another_struct_initializer() { let diagnostics = parse_and_validate( " - PROGRAM mainProg + PROGRAM mainProg VAR var_str1 : STRUCT1 := (myArr := [(x1 := FALSE, x2 := TRUE)]); END_VAR diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_dimension_mismatch.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_dimension_mismatch.snap index da865f2806..034c3f4785 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_dimension_mismatch.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_dimension_mismatch.snap @@ -3,27 +3,27 @@ source: src/validation/tests/array_validation_test.rs expression: diagnostics --- error: Expected array access with 1 dimensions, found 2 - ┌─ :13:8 + ┌─ :13:17 │ -13 │ arr[0, 1] := 1; - │ ^^^^ Expected array access with 1 dimensions, found 2 +13 │ arr[0, 1] := 1; + │ ^^^^ Expected array access with 1 dimensions, found 2 error: Expected array access with 1 dimensions, found 2 - ┌─ :14:8 + ┌─ :14:17 │ -14 │ vla[0, 1] := 1; - │ ^^^^ Expected array access with 1 dimensions, found 2 +14 │ vla[0, 1] := 1; + │ ^^^^ Expected array access with 1 dimensions, found 2 error: Expected array access with 1 dimensions, found 3 - ┌─ :15:8 + ┌─ :15:17 │ -15 │ arr[0, 1, 2] := 1; - │ ^^^^^^^ Expected array access with 1 dimensions, found 3 +15 │ arr[0, 1, 2] := 1; + │ ^^^^^^^ Expected array access with 1 dimensions, found 3 error: Expected array access with 1 dimensions, found 3 - ┌─ :16:8 + ┌─ :16:17 │ -16 │ vla[0, 1, 2] := 1; - │ ^^^^^^^ Expected array access with 1 dimensions, found 3 +16 │ vla[0, 1, 2] := 1; + │ ^^^^^^^ Expected array access with 1 dimensions, found 3 diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_validation.snap index a79831278c..6928297a58 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_access_validation.snap @@ -3,51 +3,51 @@ source: src/validation/tests/array_validation_test.rs expression: "&diagnostics" --- error: Array access must be in the range 2..3 - ┌─ :29:12 + ┌─ :29:21 │ -29 │ multi[1,4]; // out of range - │ ^ Array access must be in the range 2..3 +29 │ multi[1,4]; // out of range + │ ^ Array access must be in the range 2..3 error: Array access must be in the range 2..3 - ┌─ :30:14 + ┌─ :30:23 │ -30 │ nested[1][4]; // out of range - │ ^ Array access must be in the range 2..3 +30 │ nested[1][4]; // out of range + │ ^ Array access must be in the range 2..3 error: Array access must be in the range 0..1 - ┌─ :31:8 + ┌─ :31:17 │ -31 │ arr[3]; // out of range - │ ^ Array access must be in the range 0..1 +31 │ arr[3]; // out of range + │ ^ Array access must be in the range 0..1 error: Array access must be in the range -2..2 - ┌─ :32:19 + ┌─ :32:28 │ -32 │ negative_start[-4]; // out of range - │ ^^ Array access must be in the range -2..2 +32 │ negative_start[-4]; // out of range + │ ^^ Array access must be in the range -2..2 error: Array access must be in the range -3..-1 - ┌─ :33:13 + ┌─ :33:22 │ -33 │ negative[-4]; // out of range - │ ^^ Array access must be in the range -3..-1 +33 │ negative[-4]; // out of range + │ ^^ Array access must be in the range -3..-1 error: Array access must be in the range 1..2 - ┌─ :34:10 + ┌─ :34:19 │ -34 │ const[3]; // out of range - │ ^ Array access must be in the range 1..2 +34 │ const[3]; // out of range + │ ^ Array access must be in the range 1..2 error: Invalid type STRING for array access. Only variables of Integer types are allowed to access an array - ┌─ :35:8 + ┌─ :35:17 │ -35 │ arr[string_ref]; // invalid type for array access - │ ^^^^^^^^^^ Invalid type STRING for array access. Only variables of Integer types are allowed to access an array +35 │ arr[string_ref]; // invalid type for array access + │ ^^^^^^^^^^ Invalid type STRING for array access. Only variables of Integer types are allowed to access an array error: Invalid type INT for array access. Only variables of Array types are allowed - ┌─ :36:12 + ┌─ :36:21 │ -36 │ int_ref[1]; // not an array - │ ^ Invalid type INT for array access. Only variables of Array types are allowed +36 │ int_ref[1]; // not an array + │ ^ Invalid type INT for array access. Only variables of Array types are allowed diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_initialization_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_initialization_validation.snap index eb91d8a089..071e59081b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_initialization_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__array_initialization_validation.snap @@ -3,63 +3,63 @@ source: src/validation/tests/array_validation_test.rs expression: "&diagnostics" --- error: Array assignments must be surrounded with `[]` - ┌─ :5:35 + ┌─ :5:50 │ -5 │ arr2 : ARRAY[1..2] OF DINT := 1, 2; // Missing `[` - │ ^^^^ Array assignments must be surrounded with `[]` +5 │ arr2 : ARRAY[1..2] OF DINT := 1, 2; // Missing `[` + │ ^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :6:40 + ┌─ :6:55 │ -6 │ arr3 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := (1, 2))); // Missing `[` - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +6 │ arr3 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := (1, 2))); // Missing `[` + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :6:74 + ┌─ :6:89 │ -6 │ arr3 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := (1, 2))); // Missing `[` - │ ^^^^ Array assignments must be surrounded with `[]` +6 │ arr3 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := (1, 2))); // Missing `[` + │ ^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :7:40 + ┌─ :7:55 │ -7 │ arr4 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := 1, 2)); // Missing `[` - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +7 │ arr4 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := 1, 2)); // Missing `[` + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :7:73 + ┌─ :7:88 │ -7 │ arr4 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := 1, 2)); // Missing `[` - │ ^ Array assignments must be surrounded with `[]` +7 │ arr4 : ARRAY[1..2] OF myStruct := ((var1 := 1), (var1 := 2, var2 := 1, 2)); // Missing `[` + │ ^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :8:39 + ┌─ :8:51 │ -8 │ arr_init : ARRAY[1..2] OF DINT := (1, 2); // Missing `[` - │ ^^^^ Array assignments must be surrounded with `[]` +8 │ arr_init : ARRAY[1..2] OF DINT := (1, 2); // Missing `[` + │ ^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :10:43 + ┌─ :10:59 │ -10 │ y : myStruct := (var1 := 1, var2 := 3, 4); // Missing `[` - │ ^ Array assignments must be surrounded with `[]` +10 │ y : myStruct := (var1 := 1, var2 := 3, 4); // Missing `[` + │ ^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :12:11 + ┌─ :12:20 │ -12 │ arr := 1, 2; // Missing `[` - │ ^ Array assignments must be surrounded with `[]` +12 │ arr := 1, 2; // Missing `[` + │ ^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :13:12 + ┌─ :13:21 │ -13 │ arr := (1, 2); // Missing `[` - │ ^^^^ Array assignments must be surrounded with `[]` +13 │ arr := (1, 2); // Missing `[` + │ ^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :15:29 + ┌─ :15:40 │ -15 │ x := (var1 := 1, var2 := 3, 4); // Missing `[` - │ ^ Array assignments must be surrounded with `[]` +15 │ x := (var1 := 1, var2 := 3, 4); // Missing `[` + │ ^ Array assignments must be surrounded with `[]` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_1d.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_1d.snap index 5c898e938b..f2a359ccfc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_1d.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_1d.snap @@ -3,81 +3,81 @@ source: src/validation/tests/array_validation_test.rs expression: diagnostics --- error: Unexpected token: expected KeywordSquareParensClose but found ) - ┌─ :15:25 + ┌─ :15:34 │ -15 │ arr := [1, 2, 3, 4, 5); - │ ^ Unexpected token: expected KeywordSquareParensClose but found ) +15 │ arr := [1, 2, 3, 4, 5); + │ ^ Unexpected token: expected KeywordSquareParensClose but found ) error: Unexpected token: expected KeywordSemicolon but found ')' - ┌─ :15:25 + ┌─ :15:34 │ -15 │ arr := [1, 2, 3, 4, 5); - │ ^ Unexpected token: expected KeywordSemicolon but found ')' +15 │ arr := [1, 2, 3, 4, 5); + │ ^ Unexpected token: expected KeywordSemicolon but found ')' error: Unexpected token: expected KeywordParensClose but found ']' - ┌─ :16:25 + ┌─ :16:34 │ -16 │ arr := (1, 2, 3, 4, 5]; - │ ^ Unexpected token: expected KeywordParensClose but found ']' +16 │ arr := (1, 2, 3, 4, 5]; + │ ^ Unexpected token: expected KeywordParensClose but found ']' error: Missing expected Token [KeywordParensClose] - ┌─ :16:26 + ┌─ :16:35 │ -16 │ arr := (1, 2, 3, 4, 5]; - │ ^ Missing expected Token [KeywordParensClose] +16 │ arr := (1, 2, 3, 4, 5]; + │ ^ Missing expected Token [KeywordParensClose] error: Unexpected token: expected KeywordParensClose but found ';' - ┌─ :16:26 + ┌─ :16:35 │ -16 │ arr := (1, 2, 3, 4, 5]; - │ ^ Unexpected token: expected KeywordParensClose but found ';' +16 │ arr := (1, 2, 3, 4, 5]; + │ ^ Unexpected token: expected KeywordParensClose but found ';' error: Array __main_arr has a size of 5, but 6 elements were provided - ┌─ :4:36 + ┌─ :4:54 │ -4 │ arr : ARRAY[1..5] OF DINT := [1, 2, 3, 4, 5, 6]; - │ ^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 5, but 6 elements were provided +4 │ arr : ARRAY[1..5] OF DINT := [1, 2, 3, 4, 5, 6]; + │ ^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 5, but 6 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :5:40 + ┌─ :5:55 │ -5 │ arr_alt : ARRAY[1..5] OF DINT := (1, 2, 3, 4, 5, 6); - │ ^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +5 │ arr_alt : ARRAY[1..5] OF DINT := (1, 2, 3, 4, 5, 6); + │ ^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :11:12 + ┌─ :11:21 │ -11 │ arr := (1, 2, 3, 4); - │ ^^^^^^^^^^ Array assignments must be surrounded with `[]` +11 │ arr := (1, 2, 3, 4); + │ ^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :12:12 + ┌─ :12:21 │ -12 │ arr := (1, 2, 3, 4, 5); - │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +12 │ arr := (1, 2, 3, 4, 5); + │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :13:12 + ┌─ :13:21 │ -13 │ arr := (1, 2, 3, 4, 5, 6); - │ ^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +13 │ arr := (1, 2, 3, 4, 5, 6); + │ ^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array __main_arr has a size of 5, but 6 elements were provided - ┌─ :14:11 + ┌─ :14:20 │ -14 │ arr := [1, 2, 3, 4, 5, 6]; - │ ^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 5, but 6 elements were provided +14 │ arr := [1, 2, 3, 4, 5, 6]; + │ ^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 5, but 6 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :15:25 + ┌─ :15:34 │ -15 │ arr := [1, 2, 3, 4, 5); - │ ^ Array assignments must be surrounded with `[]` +15 │ arr := [1, 2, 3, 4, 5); + │ ^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :16:12 + ┌─ :16:21 │ -16 │ arr := (1, 2, 3, 4, 5]; - │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +16 │ arr := (1, 2, 3, 4, 5]; + │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_2d.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_2d.snap index 73f6a0dd4d..1088f43f87 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_2d.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_2d.snap @@ -3,63 +3,63 @@ source: src/validation/tests/array_validation_test.rs expression: diagnostics --- error: Array __main_arr has a size of 10, but 11 elements were provided - ┌─ :4:43 + ┌─ :4:64 │ -4 │ arr : ARRAY[1..2, 1..5] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 10, but 11 elements were provided +4 │ arr : ARRAY[1..2, 1..5] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 10, but 11 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :5:47 + ┌─ :5:65 │ -5 │ arr_alt : ARRAY[1..2, 1..5] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +5 │ arr_alt : ARRAY[1..2, 1..5] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array __main_arr_nested has a size of 10, but 15 elements were provided - ┌─ :7:57 + ┌─ :7:73 │ -7 │ arr_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 10, but 15 elements were provided +7 │ arr_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 10, but 15 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :8:62 + ┌─ :8:75 │ -8 │ arr_nested_alt : ARRAY[1..2] OF ARRAY[1..5] OF DINT := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +8 │ arr_nested_alt : ARRAY[1..2] OF ARRAY[1..5] OF DINT := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :14:12 + ┌─ :14:21 │ -14 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +14 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :15:12 + ┌─ :15:21 │ -15 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +15 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :16:12 + ┌─ :16:21 │ -16 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +16 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array __main_arr has a size of 10, but 11 elements were provided - ┌─ :17:11 + ┌─ :17:20 │ -17 │ arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 10, but 11 elements were provided +17 │ arr := [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 10, but 11 elements were provided error: Array __main_arr_nested has a size of 10, but 15 elements were provided - ┌─ :20:19 + ┌─ :20:32 │ -20 │ arr_nested := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 10, but 15 elements were provided +20 │ arr_nested := [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 10, but 15 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :21:21 + ┌─ :21:34 │ -21 │ arr_nested := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +21 │ arr_nested := ( [1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15] ); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_3d.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_3d.snap index af71ef3695..35218d5538 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_3d.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_3d.snap @@ -3,57 +3,57 @@ source: src/validation/tests/array_validation_test.rs expression: diagnostics --- error: Array __main_arr has a size of 8, but 9 elements were provided - ┌─ :4:48 + ┌─ :4:66 │ -4 │ arr : ARRAY[1..2, 1..2, 1..2] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 8, but 9 elements were provided +4 │ arr : ARRAY[1..2, 1..2, 1..2] OF DINT := [1, 2, 3, 4, 5, 6, 7, 8, 9]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 8, but 9 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :5:52 + ┌─ :5:67 │ -5 │ arr_alt : ARRAY[1..2, 1..2, 1..2] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +5 │ arr_alt : ARRAY[1..2, 1..2, 1..2] OF DINT := (1, 2, 3, 4, 5, 6, 7, 8, 9); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array __main_arr_nested has a size of 8, but 12 elements were provided - ┌─ :7:72 + ┌─ :7:88 │ -7 │ arr_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 8, but 12 elements were provided +7 │ arr_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 8, but 12 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :8:77 + ┌─ :8:90 │ -8 │ arr_nested_alt : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +8 │ arr_nested_alt : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :14:12 + ┌─ :14:21 │ -14 │ arr := (1, 2, 3, 4, 5, 6, 7, 8); - │ ^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +14 │ arr := (1, 2, 3, 4, 5, 6, 7, 8); + │ ^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :15:12 + ┌─ :15:21 │ -15 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +15 │ arr := (1, 2, 3, 4, 5, 6, 7, 8, 9); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array __main_arr has a size of 8, but 9 elements were provided - ┌─ :16:11 + ┌─ :16:20 │ -16 │ arr := [1, 2, 3, 4, 5, 6, 7, 8, 9]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 8, but 9 elements were provided +16 │ arr := [1, 2, 3, 4, 5, 6, 7, 8, 9]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr has a size of 8, but 9 elements were provided error: Array __main_arr_nested has a size of 8, but 12 elements were provided - ┌─ :19:18 + ┌─ :19:27 │ -19 │ arr_nested := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 8, but 12 elements were provided +19 │ arr_nested := [ [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ]; + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array __main_arr_nested has a size of 8, but 12 elements were provided error: Array assignments must be surrounded with `[]` - ┌─ :20:20 + ┌─ :20:29 │ -20 │ arr_nested := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +20 │ arr_nested := ( [[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]] ); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_multiplied_statement.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_multiplied_statement.snap index cb6a126568..3084c720a5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_multiplied_statement.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_multiplied_statement.snap @@ -3,63 +3,63 @@ source: src/validation/tests/array_validation_test.rs expression: diagnostics --- error: Array __main_arr_1d has a size of 5, but 6 elements were provided - ┌─ :4:37 + ┌─ :4:49 │ -4 │ arr_1d : ARRAY[1..5] OF DINT := [6(0)]; - │ ^^^^^^ Array __main_arr_1d has a size of 5, but 6 elements were provided +4 │ arr_1d : ARRAY[1..5] OF DINT := [6(0)]; + │ ^^^^^^ Array __main_arr_1d has a size of 5, but 6 elements were provided error: Array __main_arr_2d has a size of 10, but 11 elements were provided - ┌─ :6:43 + ┌─ :6:55 │ -6 │ arr_2d : ARRAY[1..2, 1..5] OF DINT := [11(0)]; - │ ^^^^^^^ Array __main_arr_2d has a size of 10, but 11 elements were provided +6 │ arr_2d : ARRAY[1..2, 1..5] OF DINT := [11(0)]; + │ ^^^^^^^ Array __main_arr_2d has a size of 10, but 11 elements were provided error: Array __main_arr_2d_nested has a size of 10, but 11 elements were provided - ┌─ :7:59 + ┌─ :7:71 │ -7 │ arr_2d_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [11(0)]; - │ ^^^^^^^ Array __main_arr_2d_nested has a size of 10, but 11 elements were provided +7 │ arr_2d_nested : ARRAY[1..2] OF ARRAY[1..5] OF DINT := [11(0)]; + │ ^^^^^^^ Array __main_arr_2d_nested has a size of 10, but 11 elements were provided error: Array __main_arr_3d has a size of 8, but 9 elements were provided - ┌─ :9:49 + ┌─ :9:61 │ -9 │ arr_3d : ARRAY[1..2, 1..2, 1..2] OF DINT := [9(0)]; - │ ^^^^^^ Array __main_arr_3d has a size of 8, but 9 elements were provided +9 │ arr_3d : ARRAY[1..2, 1..2, 1..2] OF DINT := [9(0)]; + │ ^^^^^^ Array __main_arr_3d has a size of 8, but 9 elements were provided error: Array __main_arr_3d_nested has a size of 8, but 9 elements were provided - ┌─ :10:74 + ┌─ :10:86 │ -10 │ arr_3d_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [9(0)]; - │ ^^^^^^ Array __main_arr_3d_nested has a size of 8, but 9 elements were provided +10 │ arr_3d_nested : ARRAY[1..2] OF ARRAY[1..2] OF ARRAY[1..2] OF DINT := [9(0)]; + │ ^^^^^^ Array __main_arr_3d_nested has a size of 8, but 9 elements were provided error: Array __main_arr_1d has a size of 5, but 6 elements were provided - ┌─ :21:14 + ┌─ :21:23 │ -21 │ arr_1d := [6(0)]; - │ ^^^^^^ Array __main_arr_1d has a size of 5, but 6 elements were provided +21 │ arr_1d := [6(0)]; + │ ^^^^^^ Array __main_arr_1d has a size of 5, but 6 elements were provided error: Array __main_arr_2d has a size of 10, but 11 elements were provided - ┌─ :22:14 + ┌─ :22:23 │ -22 │ arr_2d := [11(0)]; - │ ^^^^^^^ Array __main_arr_2d has a size of 10, but 11 elements were provided +22 │ arr_2d := [11(0)]; + │ ^^^^^^^ Array __main_arr_2d has a size of 10, but 11 elements were provided error: Array __main_arr_2d_nested has a size of 10, but 11 elements were provided - ┌─ :23:21 + ┌─ :23:30 │ -23 │ arr_2d_nested := [11(0)]; - │ ^^^^^^^ Array __main_arr_2d_nested has a size of 10, but 11 elements were provided +23 │ arr_2d_nested := [11(0)]; + │ ^^^^^^^ Array __main_arr_2d_nested has a size of 10, but 11 elements were provided error: Array __main_arr_3d has a size of 8, but 9 elements were provided - ┌─ :24:14 + ┌─ :24:23 │ -24 │ arr_3d := [9(0)]; - │ ^^^^^^ Array __main_arr_3d has a size of 8, but 9 elements were provided +24 │ arr_3d := [9(0)]; + │ ^^^^^^ Array __main_arr_3d has a size of 8, but 9 elements were provided error: Array __main_arr_3d_nested has a size of 8, but 9 elements were provided - ┌─ :25:21 + ┌─ :25:30 │ -25 │ arr_3d_nested := [9(0)]; - │ ^^^^^^ Array __main_arr_3d_nested has a size of 8, but 9 elements were provided +25 │ arr_3d_nested := [9(0)]; + │ ^^^^^^ Array __main_arr_3d_nested has a size of 8, but 9 elements were provided diff --git a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_structs.snap b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_structs.snap index e0d7cbeceb..17d1c1ac29 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_structs.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__array_validation_test__assignment_structs.snap @@ -3,39 +3,39 @@ source: src/validation/tests/array_validation_test.rs expression: diagnostics --- error: Array assignments must be surrounded with `[]` - ┌─ :18:57 + ┌─ :18:70 │ -18 │ foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +18 │ foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :18:83 + ┌─ :18:96 │ -18 │ foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +18 │ foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :18:48 + ┌─ :18:61 │ -18 │ foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +18 │ foo_invalid_0 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :19:57 + ┌─ :19:70 │ -19 │ foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +19 │ foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :19:83 + ┌─ :19:96 │ -19 │ foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +19 │ foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + │ ^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` error: Array assignments must be surrounded with `[]` - ┌─ :19:48 + ┌─ :19:61 │ -19 │ foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` +19 │ foo_invalid_1 : FOO := (idx := 0, arr := ((arr := (1, 2, 3, 4, 5)), (arr := (1, 2, 3, 4, 5)))); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array assignments must be surrounded with `[]` diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__array_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__array_assignment_validation.snap index af8364070d..58f77aa6b2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__array_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__array_assignment_validation.snap @@ -2,21 +2,21 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_sized_string2' to '__main_v_arr_sized_string'", range: [SourceLocation { span: Range(TextLocation { line: 29, column: 4, offset: 761 }..TextLocation { line: 29, column: 45, offset: 802 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_int_2' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 4, offset: 819 }..TextLocation { line: 30, column: 30, offset: 845 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_int_4' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 32, column: 4, offset: 903 }..TextLocation { line: 32, column: 30, offset: 929 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_real_3' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 33, column: 4, offset: 946 }..TextLocation { line: 33, column: 31, offset: 973 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_string_3' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 34, column: 4, offset: 990 }..TextLocation { line: 34, column: 33, offset: 1019 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_char_3' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 4, offset: 1036 }..TextLocation { line: 35, column: 31, offset: 1063 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Array assignments must be surrounded with `[]`", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 19, offset: 1095 }..TextLocation { line: 36, column: 20, offset: 1096 }) }], err_no: arr__invalid_array_assignment } -SyntaxError { message: "Array assignments must be surrounded with `[]`", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 20, offset: 1138 }..TextLocation { line: 37, column: 30, offset: 1148 }) }], err_no: arr__invalid_array_assignment } -SyntaxError { message: "Array assignments must be surrounded with `[]`", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 20, offset: 1180 }..TextLocation { line: 38, column: 36, offset: 1196 }) }], err_no: arr__invalid_array_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 1384 }..TextLocation { line: 43, column: 30, offset: 1410 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1427 }..TextLocation { line: 44, column: 37, offset: 1460 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 1477 }..TextLocation { line: 45, column: 30, offset: 1503 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1520 }..TextLocation { line: 46, column: 28, offset: 1544 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1561 }..TextLocation { line: 47, column: 30, offset: 1587 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 49, column: 4, offset: 1647 }..TextLocation { line: 49, column: 35, offset: 1678 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1695 }..TextLocation { line: 50, column: 25, offset: 1716 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_int_3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 51, column: 4, offset: 1733 }..TextLocation { line: 51, column: 25, offset: 1754 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_sized_string2' to '__main_v_arr_sized_string'", range: [SourceLocation { span: Range(TextLocation { line: 29, column: 4, offset: 729 }..TextLocation { line: 29, column: 45, offset: 770 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_int_2' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 4, offset: 787 }..TextLocation { line: 30, column: 30, offset: 813 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_int_4' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 32, column: 4, offset: 871 }..TextLocation { line: 32, column: 30, offset: 897 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_real_3' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 33, column: 4, offset: 914 }..TextLocation { line: 33, column: 31, offset: 941 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_string_3' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 34, column: 4, offset: 958 }..TextLocation { line: 34, column: 33, offset: 987 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_char_3' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 4, offset: 1004 }..TextLocation { line: 35, column: 31, offset: 1031 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Array assignments must be surrounded with `[]`", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 19, offset: 1063 }..TextLocation { line: 36, column: 20, offset: 1064 }) }], err_no: arr__invalid_array_assignment } +SyntaxError { message: "Array assignments must be surrounded with `[]`", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 20, offset: 1106 }..TextLocation { line: 37, column: 30, offset: 1116 }) }], err_no: arr__invalid_array_assignment } +SyntaxError { message: "Array assignments must be surrounded with `[]`", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 20, offset: 1148 }..TextLocation { line: 38, column: 36, offset: 1164 }) }], err_no: arr__invalid_array_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 1352 }..TextLocation { line: 43, column: 30, offset: 1378 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1395 }..TextLocation { line: 44, column: 37, offset: 1428 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 1445 }..TextLocation { line: 45, column: 30, offset: 1471 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1488 }..TextLocation { line: 46, column: 28, offset: 1512 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1529 }..TextLocation { line: 47, column: 30, offset: 1555 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 49, column: 4, offset: 1615 }..TextLocation { line: 49, column: 35, offset: 1646 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to '__main_v_arr_int_3'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1663 }..TextLocation { line: 50, column: 25, offset: 1684 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_arr_int_3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 51, column: 4, offset: 1701 }..TextLocation { line: 51, column: 25, offset: 1722 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__bit_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__bit_assignment_validation.snap index 4282b2b621..0a8291248b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__bit_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__bit_assignment_validation.snap @@ -2,11 +2,11 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 807 }..TextLocation { line: 38, column: 22, offset: 825 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 842 }..TextLocation { line: 39, column: 29, offset: 867 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 884 }..TextLocation { line: 40, column: 22, offset: 902 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 919 }..TextLocation { line: 41, column: 20, offset: 935 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 952 }..TextLocation { line: 42, column: 22, offset: 970 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1089 }..TextLocation { line: 46, column: 27, offset: 1112 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1168 }..TextLocation { line: 48, column: 31, offset: 1195 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 775 }..TextLocation { line: 38, column: 22, offset: 793 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 810 }..TextLocation { line: 39, column: 29, offset: 835 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 852 }..TextLocation { line: 40, column: 22, offset: 870 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 887 }..TextLocation { line: 41, column: 20, offset: 903 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 920 }..TextLocation { line: 42, column: 22, offset: 938 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1057 }..TextLocation { line: 46, column: 27, offset: 1080 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1136 }..TextLocation { line: 48, column: 31, offset: 1163 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__char_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__char_assignment_validation.snap index 4e9f8f907c..1fbeda4d02 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__char_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__char_assignment_validation.snap @@ -2,29 +2,29 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'LREAL' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 31, column: 4, offset: 571 }..TextLocation { line: 31, column: 21, offset: 588 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'REAL' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 32, column: 4, offset: 605 }..TextLocation { line: 32, column: 22, offset: 623 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 33, column: 4, offset: 640 }..TextLocation { line: 33, column: 21, offset: 657 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 34, column: 4, offset: 674 }..TextLocation { line: 34, column: 22, offset: 692 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 4, offset: 709 }..TextLocation { line: 35, column: 20, offset: 725 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 4, offset: 742 }..TextLocation { line: 36, column: 21, offset: 759 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 4, offset: 776 }..TextLocation { line: 37, column: 20, offset: 792 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 809 }..TextLocation { line: 38, column: 28, offset: 833 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 850 }..TextLocation { line: 39, column: 20, offset: 866 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 883 }..TextLocation { line: 40, column: 26, offset: 905 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 922 }..TextLocation { line: 41, column: 23, offset: 941 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 973 }..TextLocation { line: 42, column: 24, offset: 993 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1053 }..TextLocation { line: 44, column: 17, offset: 1066 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 1083 }..TextLocation { line: 45, column: 22, offset: 1101 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1118 }..TextLocation { line: 46, column: 29, offset: 1143 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Value: 'string' exceeds length for type: CHAR", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1160 }..TextLocation { line: 47, column: 22, offset: 1178 }) }], err_no: syntax__generic_error } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1160 }..TextLocation { line: 47, column: 22, offset: 1178 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1259 }..TextLocation { line: 50, column: 21, offset: 1276 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 51, column: 4, offset: 1293 }..TextLocation { line: 51, column: 23, offset: 1312 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 52, column: 4, offset: 1329 }..TextLocation { line: 52, column: 19, offset: 1344 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 53, column: 4, offset: 1361 }..TextLocation { line: 53, column: 26, offset: 1383 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 54, column: 4, offset: 1400 }..TextLocation { line: 54, column: 24, offset: 1420 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 55, column: 4, offset: 1437 }..TextLocation { line: 55, column: 27, offset: 1460 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 56, column: 4, offset: 1477 }..TextLocation { line: 56, column: 28, offset: 1501 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 57, column: 4, offset: 1518 }..TextLocation { line: 57, column: 31, offset: 1545 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'LREAL' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 31, column: 4, offset: 531 }..TextLocation { line: 31, column: 21, offset: 548 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'REAL' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 32, column: 4, offset: 565 }..TextLocation { line: 32, column: 22, offset: 583 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 33, column: 4, offset: 600 }..TextLocation { line: 33, column: 21, offset: 617 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 34, column: 4, offset: 634 }..TextLocation { line: 34, column: 22, offset: 652 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 4, offset: 669 }..TextLocation { line: 35, column: 20, offset: 685 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 4, offset: 702 }..TextLocation { line: 36, column: 21, offset: 719 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 4, offset: 736 }..TextLocation { line: 37, column: 20, offset: 752 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 769 }..TextLocation { line: 38, column: 28, offset: 793 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 810 }..TextLocation { line: 39, column: 20, offset: 826 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 843 }..TextLocation { line: 40, column: 26, offset: 865 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 882 }..TextLocation { line: 41, column: 23, offset: 901 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 933 }..TextLocation { line: 42, column: 24, offset: 953 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1013 }..TextLocation { line: 44, column: 17, offset: 1026 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 1043 }..TextLocation { line: 45, column: 22, offset: 1061 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1078 }..TextLocation { line: 46, column: 29, offset: 1103 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Value: 'string' exceeds length for type: CHAR", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1120 }..TextLocation { line: 47, column: 22, offset: 1138 }) }], err_no: syntax__generic_error } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1120 }..TextLocation { line: 47, column: 22, offset: 1138 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1219 }..TextLocation { line: 50, column: 21, offset: 1236 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 51, column: 4, offset: 1253 }..TextLocation { line: 51, column: 23, offset: 1272 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 52, column: 4, offset: 1289 }..TextLocation { line: 52, column: 19, offset: 1304 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 53, column: 4, offset: 1321 }..TextLocation { line: 53, column: 26, offset: 1343 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 54, column: 4, offset: 1360 }..TextLocation { line: 54, column: 24, offset: 1380 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 55, column: 4, offset: 1397 }..TextLocation { line: 55, column: 27, offset: 1420 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 56, column: 4, offset: 1437 }..TextLocation { line: 56, column: 28, offset: 1461 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 57, column: 4, offset: 1478 }..TextLocation { line: 57, column: 31, offset: 1505 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__constant_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__constant_assignment_validation.snap index 0698108984..a667b02c5f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__constant_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__constant_assignment_validation.snap @@ -2,5 +2,5 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Cannot assign to CONSTANT 'v_global'", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 4, offset: 123 }..TextLocation { line: 7, column: 12, offset: 131 }) }], err_no: var__cannot_assign_to_const } +SyntaxError { message: "Cannot assign to CONSTANT 'v_global'", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 4, offset: 119 }..TextLocation { line: 7, column: 12, offset: 127 }) }], err_no: var__cannot_assign_to_const } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__date_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__date_assignment_validation.snap index 98ed103fc9..47da84344e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__date_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__date_assignment_validation.snap @@ -2,11 +2,11 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 812 }..TextLocation { line: 38, column: 22, offset: 830 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 847 }..TextLocation { line: 39, column: 29, offset: 872 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 889 }..TextLocation { line: 40, column: 22, offset: 907 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 924 }..TextLocation { line: 41, column: 20, offset: 940 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 957 }..TextLocation { line: 42, column: 22, offset: 975 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1094 }..TextLocation { line: 46, column: 27, offset: 1117 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1173 }..TextLocation { line: 48, column: 31, offset: 1200 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 776 }..TextLocation { line: 38, column: 22, offset: 794 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 811 }..TextLocation { line: 39, column: 29, offset: 836 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 853 }..TextLocation { line: 40, column: 22, offset: 871 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 888 }..TextLocation { line: 41, column: 20, offset: 904 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 921 }..TextLocation { line: 42, column: 22, offset: 939 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1058 }..TextLocation { line: 46, column: 27, offset: 1081 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1137 }..TextLocation { line: 48, column: 31, offset: 1164 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__duration_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__duration_assignment_validation.snap index 740974f392..d31c506dfb 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__duration_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__duration_assignment_validation.snap @@ -2,11 +2,11 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 816 }..TextLocation { line: 38, column: 22, offset: 834 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 851 }..TextLocation { line: 39, column: 29, offset: 876 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 893 }..TextLocation { line: 40, column: 22, offset: 911 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 928 }..TextLocation { line: 41, column: 20, offset: 944 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 961 }..TextLocation { line: 42, column: 22, offset: 979 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1098 }..TextLocation { line: 46, column: 27, offset: 1121 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1177 }..TextLocation { line: 48, column: 31, offset: 1204 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 780 }..TextLocation { line: 38, column: 22, offset: 798 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 815 }..TextLocation { line: 39, column: 29, offset: 840 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 857 }..TextLocation { line: 40, column: 22, offset: 875 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 892 }..TextLocation { line: 41, column: 20, offset: 908 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 925 }..TextLocation { line: 42, column: 22, offset: 943 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1062 }..TextLocation { line: 46, column: 27, offset: 1085 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1141 }..TextLocation { line: 48, column: 31, offset: 1168 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__enum_variants_mismatch.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__enum_variants_mismatch.snap index 98c995dff2..efacb1a32d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__enum_variants_mismatch.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__enum_variants_mismatch.snap @@ -2,8 +2,8 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SemanticError { message: "Assigned value is not a variant of main.color", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 291 }..TextLocation { line: 10, column: 24, offset: 294 }) }], err_no: var__invalid_enum_variant } -SemanticError { message: "Assigned value is not a variant of main.water", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 334 }..TextLocation { line: 11, column: 25, offset: 338 }) }], err_no: var__invalid_enum_variant } -SemanticError { message: "Assigned value is not a variant of main.color", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 21, offset: 377 }..TextLocation { line: 12, column: 30, offset: 386 }) }], err_no: var__invalid_enum_variant } -SemanticError { message: "Assigned value is not a variant of main.color", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 21, offset: 420 }..TextLocation { line: 13, column: 22, offset: 421 }) }], err_no: var__invalid_enum_variant } +SemanticError { message: "Assigned value is not a variant of main.color", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 283 }..TextLocation { line: 10, column: 24, offset: 286 }) }], err_no: var__invalid_enum_variant } +SemanticError { message: "Assigned value is not a variant of main.water", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 326 }..TextLocation { line: 11, column: 25, offset: 330 }) }], err_no: var__invalid_enum_variant } +SemanticError { message: "Assigned value is not a variant of main.color", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 21, offset: 369 }..TextLocation { line: 12, column: 30, offset: 378 }) }], err_no: var__invalid_enum_variant } +SemanticError { message: "Assigned value is not a variant of main.color", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 21, offset: 412 }..TextLocation { line: 13, column: 22, offset: 413 }) }], err_no: var__invalid_enum_variant } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_action_downcasts_are_validated.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_action_downcasts_are_validated.snap index 9005b0bdc4..1d1336ec39 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_action_downcasts_are_validated.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_action_downcasts_are_validated.snap @@ -2,5 +2,5 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 31, offset: 564 }..TextLocation { line: 25, column: 35, offset: 568 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'BYTE'", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 31, offset: 548 }..TextLocation { line: 25, column: 35, offset: 552 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_invalid_action_call_assignments_are_validated.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_invalid_action_call_assignments_are_validated.snap index 0de113e839..ab08bc0074 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_invalid_action_call_assignments_are_validated.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__implicit_invalid_action_call_assignments_are_validated.snap @@ -2,6 +2,6 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 19, offset: 532 }..TextLocation { line: 23, column: 22, offset: 535 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 24, offset: 537 }..TextLocation { line: 23, column: 27, offset: 540 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 19, offset: 516 }..TextLocation { line: 23, column: 22, offset: 519 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 24, offset: 521 }..TextLocation { line: 23, column: 27, offset: 524 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__int_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__int_assignment_validation.snap index c6ae8e377d..8432940d79 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__int_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__int_assignment_validation.snap @@ -2,18 +2,18 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 880 }..TextLocation { line: 40, column: 23, offset: 899 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 916 }..TextLocation { line: 41, column: 30, offset: 942 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 959 }..TextLocation { line: 42, column: 23, offset: 978 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 995 }..TextLocation { line: 43, column: 21, offset: 1012 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1029 }..TextLocation { line: 44, column: 23, offset: 1048 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1170 }..TextLocation { line: 48, column: 28, offset: 1194 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1251 }..TextLocation { line: 50, column: 32, offset: 1279 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 63, column: 4, offset: 1646 }..TextLocation { line: 63, column: 22, offset: 1664 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 64, column: 4, offset: 1681 }..TextLocation { line: 64, column: 29, offset: 1706 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 65, column: 4, offset: 1723 }..TextLocation { line: 65, column: 22, offset: 1741 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 66, column: 4, offset: 1758 }..TextLocation { line: 66, column: 20, offset: 1774 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 67, column: 4, offset: 1791 }..TextLocation { line: 67, column: 22, offset: 1809 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 71, column: 4, offset: 1928 }..TextLocation { line: 71, column: 27, offset: 1951 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 73, column: 4, offset: 2007 }..TextLocation { line: 73, column: 31, offset: 2034 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 840 }..TextLocation { line: 40, column: 23, offset: 859 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 876 }..TextLocation { line: 41, column: 30, offset: 902 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 919 }..TextLocation { line: 42, column: 23, offset: 938 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 955 }..TextLocation { line: 43, column: 21, offset: 972 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 989 }..TextLocation { line: 44, column: 23, offset: 1008 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1130 }..TextLocation { line: 48, column: 28, offset: 1154 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'UDINT'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1211 }..TextLocation { line: 50, column: 32, offset: 1239 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 63, column: 4, offset: 1602 }..TextLocation { line: 63, column: 22, offset: 1620 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 64, column: 4, offset: 1637 }..TextLocation { line: 64, column: 29, offset: 1662 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 65, column: 4, offset: 1679 }..TextLocation { line: 65, column: 22, offset: 1697 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 66, column: 4, offset: 1714 }..TextLocation { line: 66, column: 20, offset: 1730 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 67, column: 4, offset: 1747 }..TextLocation { line: 67, column: 22, offset: 1765 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 71, column: 4, offset: 1884 }..TextLocation { line: 71, column: 27, offset: 1907 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 73, column: 4, offset: 1963 }..TextLocation { line: 73, column: 31, offset: 1990 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_function_block_instantiation_is_validated.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_function_block_instantiation_is_validated.snap index 6d4f043879..13a20dfb10 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_function_block_instantiation_is_validated.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_function_block_instantiation_is_validated.snap @@ -2,8 +2,8 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'WSTRING'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 15, offset: 323 }..TextLocation { line: 14, column: 22, offset: 330 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__prog_arr_64' to '__fb_t_arr_32'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 24, offset: 332 }..TextLocation { line: 14, column: 40, offset: 348 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'WSTRING'", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 15, offset: 386 }..TextLocation { line: 15, column: 16, offset: 387 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__prog_arr_64' to '__fb_t_arr_32'", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 18, offset: 389 }..TextLocation { line: 15, column: 24, offset: 395 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'WSTRING'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 15, offset: 319 }..TextLocation { line: 14, column: 22, offset: 326 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__prog_arr_64' to '__fb_t_arr_32'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 24, offset: 328 }..TextLocation { line: 14, column: 40, offset: 344 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'WSTRING'", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 15, offset: 382 }..TextLocation { line: 15, column: 16, offset: 383 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__prog_arr_64' to '__fb_t_arr_32'", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 18, offset: 385 }..TextLocation { line: 15, column: 24, offset: 391 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_method_call_assignments_are_validated.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_method_call_assignments_are_validated.snap index a65376c0ba..bdc1434d4e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_method_call_assignments_are_validated.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__invalid_method_call_assignments_are_validated.snap @@ -2,6 +2,6 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 19, offset: 435 }..TextLocation { line: 21, column: 22, offset: 438 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 24, offset: 440 }..TextLocation { line: 21, column: 27, offset: 443 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 19, offset: 425 }..TextLocation { line: 21, column: 22, offset: 428 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 24, offset: 430 }..TextLocation { line: 21, column: 27, offset: 433 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap index 053e80fe4d..e4c8298392 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__pointer_assignment_validation.snap @@ -2,13 +2,13 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 4, offset: 448 }..TextLocation { line: 27, column: 23, offset: 467 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_ptr_int' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 4, offset: 448 }..TextLocation { line: 27, column: 23, offset: 467 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "The type WORD 16 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 4, offset: 484 }..TextLocation { line: 28, column: 23, offset: 503 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__main_v_ptr_int' to 'WORD'", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 4, offset: 484 }..TextLocation { line: 28, column: 23, offset: 503 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__main_v_ptr_int'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 4, offset: 555 }..TextLocation { line: 30, column: 24, offset: 575 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__main_v_ptr_int'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 934 }..TextLocation { line: 40, column: 26, offset: 956 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 973 }..TextLocation { line: 41, column: 26, offset: 995 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 1077 }..TextLocation { line: 43, column: 24, offset: 1097 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1227 }..TextLocation { line: 47, column: 35, offset: 1258 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 4, offset: 412 }..TextLocation { line: 27, column: 23, offset: 431 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_ptr_int' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 4, offset: 412 }..TextLocation { line: 27, column: 23, offset: 431 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type WORD 16 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 4, offset: 448 }..TextLocation { line: 28, column: 23, offset: 467 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__main_v_ptr_int' to 'WORD'", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 4, offset: 448 }..TextLocation { line: 28, column: 23, offset: 467 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__main_v_ptr_int'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 4, offset: 519 }..TextLocation { line: 30, column: 24, offset: 539 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__main_v_ptr_int'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 898 }..TextLocation { line: 40, column: 26, offset: 920 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 937 }..TextLocation { line: 41, column: 26, offset: 959 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 1041 }..TextLocation { line: 43, column: 24, offset: 1061 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1191 }..TextLocation { line: 47, column: 35, offset: 1222 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__real_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__real_assignment_validation.snap index f26ad5a6f8..9126bdd1a2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__real_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__real_assignment_validation.snap @@ -2,11 +2,11 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 816 }..TextLocation { line: 38, column: 22, offset: 834 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 851 }..TextLocation { line: 39, column: 29, offset: 876 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 893 }..TextLocation { line: 40, column: 22, offset: 911 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 928 }..TextLocation { line: 41, column: 20, offset: 944 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 961 }..TextLocation { line: 42, column: 22, offset: 979 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1098 }..TextLocation { line: 46, column: 27, offset: 1121 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1177 }..TextLocation { line: 48, column: 31, offset: 1204 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 776 }..TextLocation { line: 38, column: 22, offset: 794 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 811 }..TextLocation { line: 39, column: 29, offset: 836 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 40, column: 4, offset: 853 }..TextLocation { line: 40, column: 22, offset: 871 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 41, column: 4, offset: 888 }..TextLocation { line: 41, column: 20, offset: 904 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 42, column: 4, offset: 921 }..TextLocation { line: 42, column: 22, offset: 939 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1058 }..TextLocation { line: 46, column: 27, offset: 1081 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1137 }..TextLocation { line: 48, column: 31, offset: 1164 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__string_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__string_assignment_validation.snap index 15d258721f..e647402cbb 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__string_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__string_assignment_validation.snap @@ -2,23 +2,23 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'LREAL' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 4, offset: 548 }..TextLocation { line: 30, column: 23, offset: 567 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'REAL' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 31, column: 4, offset: 584 }..TextLocation { line: 31, column: 24, offset: 604 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 32, column: 4, offset: 621 }..TextLocation { line: 32, column: 23, offset: 640 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 33, column: 4, offset: 657 }..TextLocation { line: 33, column: 24, offset: 677 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 34, column: 4, offset: 694 }..TextLocation { line: 34, column: 22, offset: 712 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 4, offset: 729 }..TextLocation { line: 35, column: 23, offset: 748 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 4, offset: 765 }..TextLocation { line: 36, column: 22, offset: 783 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 4, offset: 800 }..TextLocation { line: 37, column: 30, offset: 826 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 843 }..TextLocation { line: 38, column: 22, offset: 861 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 878 }..TextLocation { line: 39, column: 28, offset: 902 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 1028 }..TextLocation { line: 43, column: 25, offset: 1049 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1066 }..TextLocation { line: 44, column: 33, offset: 1095 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 1112 }..TextLocation { line: 45, column: 25, offset: 1133 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1150 }..TextLocation { line: 46, column: 22, offset: 1168 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1185 }..TextLocation { line: 47, column: 24, offset: 1205 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1222 }..TextLocation { line: 48, column: 21, offset: 1239 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 49, column: 4, offset: 1256 }..TextLocation { line: 49, column: 28, offset: 1280 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1297 }..TextLocation { line: 50, column: 26, offset: 1319 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 52, column: 4, offset: 1376 }..TextLocation { line: 52, column: 30, offset: 1402 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'LREAL' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 4, offset: 508 }..TextLocation { line: 30, column: 23, offset: 527 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'REAL' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 31, column: 4, offset: 544 }..TextLocation { line: 31, column: 24, offset: 564 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 32, column: 4, offset: 581 }..TextLocation { line: 32, column: 23, offset: 600 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 33, column: 4, offset: 617 }..TextLocation { line: 33, column: 24, offset: 637 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 34, column: 4, offset: 654 }..TextLocation { line: 34, column: 22, offset: 672 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 4, offset: 689 }..TextLocation { line: 35, column: 23, offset: 708 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 4, offset: 725 }..TextLocation { line: 36, column: 22, offset: 743 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 4, offset: 760 }..TextLocation { line: 37, column: 30, offset: 786 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 4, offset: 803 }..TextLocation { line: 38, column: 22, offset: 821 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 4, offset: 838 }..TextLocation { line: 39, column: 28, offset: 862 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 43, column: 4, offset: 988 }..TextLocation { line: 43, column: 25, offset: 1009 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 44, column: 4, offset: 1026 }..TextLocation { line: 44, column: 33, offset: 1055 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 1072 }..TextLocation { line: 45, column: 25, offset: 1093 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 1110 }..TextLocation { line: 46, column: 22, offset: 1128 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 4, offset: 1145 }..TextLocation { line: 47, column: 24, offset: 1165 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 4, offset: 1182 }..TextLocation { line: 48, column: 21, offset: 1199 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 49, column: 4, offset: 1216 }..TextLocation { line: 49, column: 28, offset: 1240 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 50, column: 4, offset: 1257 }..TextLocation { line: 50, column: 26, offset: 1279 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 52, column: 4, offset: 1336 }..TextLocation { line: 52, column: 30, offset: 1362 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap index 67ca9d1aa4..22cb0ebbe1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__assignment_validation_tests__struct_assignment_validation.snap @@ -2,15 +2,15 @@ source: src/validation/tests/assignment_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT1' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 758 }..TextLocation { line: 45, column: 23, offset: 777 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'REAL' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 794 }..TextLocation { line: 46, column: 23, offset: 813 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 49, column: 4, offset: 870 }..TextLocation { line: 49, column: 26, offset: 892 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 52, column: 18, offset: 978 }..TextLocation { line: 52, column: 42, offset: 1002 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 55, column: 9, offset: 1077 }..TextLocation { line: 55, column: 39, offset: 1107 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 66, column: 4, offset: 1422 }..TextLocation { line: 66, column: 35, offset: 1453 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 67, column: 4, offset: 1470 }..TextLocation { line: 67, column: 37, offset: 1503 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_CHAR' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 68, column: 4, offset: 1520 }..TextLocation { line: 68, column: 35, offset: 1551 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 70, column: 4, offset: 1573 }..TextLocation { line: 70, column: 33, offset: 1602 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 71, column: 4, offset: 1619 }..TextLocation { line: 71, column: 35, offset: 1650 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_CHAR' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 72, column: 4, offset: 1667 }..TextLocation { line: 72, column: 33, offset: 1696 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT1' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 45, column: 4, offset: 754 }..TextLocation { line: 45, column: 23, offset: 773 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'REAL' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 4, offset: 790 }..TextLocation { line: 46, column: 23, offset: 809 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 49, column: 4, offset: 866 }..TextLocation { line: 49, column: 26, offset: 888 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 52, column: 18, offset: 974 }..TextLocation { line: 52, column: 42, offset: 998 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRUCT2' to 'STRUCT1'", range: [SourceLocation { span: Range(TextLocation { line: 55, column: 9, offset: 1073 }..TextLocation { line: 55, column: 39, offset: 1103 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 66, column: 4, offset: 1410 }..TextLocation { line: 66, column: 35, offset: 1441 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 67, column: 4, offset: 1458 }..TextLocation { line: 67, column: 37, offset: 1491 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_CHAR' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 68, column: 4, offset: 1508 }..TextLocation { line: 68, column: 35, offset: 1539 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 70, column: 4, offset: 1557 }..TextLocation { line: 70, column: 33, offset: 1586 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 71, column: 4, offset: 1603 }..TextLocation { line: 71, column: 35, offset: 1634 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_CHAR' to '__main_v_ref_to_struct1'", range: [SourceLocation { span: Range(TextLocation { line: 72, column: 4, offset: 1651 }..TextLocation { line: 72, column: 33, offset: 1680 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_only_on_bit_types.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_only_on_bit_types.snap index a207312d09..af71110414 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_only_on_bit_types.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_only_on_bit_types.snap @@ -2,7 +2,7 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Bit-Wise access requires a Numerical type larger than 1 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 20, offset: 223 }..TextLocation { line: 10, column: 21, offset: 224 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "Bit-Wise access requires a Numerical type larger than 1 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 247 }..TextLocation { line: 11, column: 22, offset: 248 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "Bit-Wise access requires a Numerical type larger than 1 bits", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 20, offset: 270 }..TextLocation { line: 12, column: 21, offset: 271 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Bit-Wise access requires a Numerical type larger than 1 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 20, offset: 222 }..TextLocation { line: 10, column: 21, offset: 223 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Bit-Wise access requires a Numerical type larger than 1 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 246 }..TextLocation { line: 11, column: 22, offset: 247 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Bit-Wise access requires a Numerical type larger than 1 bits", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 20, offset: 269 }..TextLocation { line: 12, column: 21, offset: 270 }) }], err_no: type__incompatible_directaccess } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap index e13ef2b0c3..04e2bd713c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__bitaccess_range_test.snap @@ -2,8 +2,8 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Bit-Wise access for type BYTE must be in the range 0..7", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 138 }..TextLocation { line: 5, column: 19, offset: 139 }) }], err_no: type__incompatible_directaccess_range } -SyntaxError { message: "Bit-Wise access for type WORD must be in the range 0..15", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 159 }..TextLocation { line: 6, column: 20, offset: 161 }) }], err_no: type__incompatible_directaccess_range } -SyntaxError { message: "Bit-Wise access for type DWORD must be in the range 0..31", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 18, offset: 181 }..TextLocation { line: 7, column: 20, offset: 183 }) }], err_no: type__incompatible_directaccess_range } -SyntaxError { message: "Bit-Wise access for type LWORD must be in the range 0..63", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 18, offset: 203 }..TextLocation { line: 8, column: 20, offset: 205 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Bit-Wise access for type BYTE must be in the range 0..7", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 137 }..TextLocation { line: 5, column: 19, offset: 138 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Bit-Wise access for type WORD must be in the range 0..15", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 158 }..TextLocation { line: 6, column: 20, offset: 160 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Bit-Wise access for type DWORD must be in the range 0..31", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 18, offset: 180 }..TextLocation { line: 7, column: 20, offset: 182 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Bit-Wise access for type LWORD must be in the range 0..63", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 18, offset: 202 }..TextLocation { line: 8, column: 20, offset: 204 }) }], err_no: type__incompatible_directaccess_range } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_only_on_bigger_sizes.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_only_on_bigger_sizes.snap index bdc955b11d..6d500b3f39 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_only_on_bigger_sizes.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_only_on_bigger_sizes.snap @@ -2,7 +2,7 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Byte-Wise access requires a Numerical type larger than 8 bits", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 20, offset: 195 }..TextLocation { line: 9, column: 23, offset: 198 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "Byte-Wise access requires a Numerical type larger than 8 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 221 }..TextLocation { line: 10, column: 24, offset: 224 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "Byte-Wise access requires a Numerical type larger than 8 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 247 }..TextLocation { line: 11, column: 24, offset: 250 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Byte-Wise access requires a Numerical type larger than 8 bits", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 20, offset: 194 }..TextLocation { line: 9, column: 23, offset: 197 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Byte-Wise access requires a Numerical type larger than 8 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 220 }..TextLocation { line: 10, column: 24, offset: 223 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Byte-Wise access requires a Numerical type larger than 8 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 246 }..TextLocation { line: 11, column: 24, offset: 249 }) }], err_no: type__incompatible_directaccess } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap index fcfd804994..8c1c7fea53 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__byteaccess_range_test.snap @@ -2,7 +2,7 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Byte-Wise access for type WORD must be in the range 0..1", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 128 }..TextLocation { line: 5, column: 21, offset: 131 }) }], err_no: type__incompatible_directaccess_range } -SyntaxError { message: "Byte-Wise access for type DWORD must be in the range 0..3", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 151 }..TextLocation { line: 6, column: 21, offset: 154 }) }], err_no: type__incompatible_directaccess_range } -SyntaxError { message: "Byte-Wise access for type LWORD must be in the range 0..7", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 18, offset: 174 }..TextLocation { line: 7, column: 21, offset: 177 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Byte-Wise access for type WORD must be in the range 0..1", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 127 }..TextLocation { line: 5, column: 21, offset: 130 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Byte-Wise access for type DWORD must be in the range 0..3", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 150 }..TextLocation { line: 6, column: 21, offset: 153 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Byte-Wise access for type LWORD must be in the range 0..7", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 18, offset: 173 }..TextLocation { line: 7, column: 21, offset: 176 }) }], err_no: type__incompatible_directaccess_range } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_only_on_bigger_sizes.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_only_on_bigger_sizes.snap index 76e0d33ff5..4d655bcabc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_only_on_bigger_sizes.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_only_on_bigger_sizes.snap @@ -2,7 +2,7 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "DWord-Wise access requires a Numerical type larger than 32 bits", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 20, offset: 197 }..TextLocation { line: 9, column: 23, offset: 200 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "DWord-Wise access requires a Numerical type larger than 32 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 223 }..TextLocation { line: 10, column: 24, offset: 226 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "DWord-Wise access requires a Numerical type larger than 32 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 249 }..TextLocation { line: 11, column: 24, offset: 252 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "DWord-Wise access requires a Numerical type larger than 32 bits", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 20, offset: 196 }..TextLocation { line: 9, column: 23, offset: 199 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "DWord-Wise access requires a Numerical type larger than 32 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 222 }..TextLocation { line: 10, column: 24, offset: 225 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "DWord-Wise access requires a Numerical type larger than 32 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 248 }..TextLocation { line: 11, column: 24, offset: 251 }) }], err_no: type__incompatible_directaccess } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap index 1153059e4f..419f2365ff 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__dwordaccess_range_test.snap @@ -2,5 +2,5 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "DWord-Wise access for type LWORD must be in the range 0..1", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 107 }..TextLocation { line: 5, column: 21, offset: 110 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "DWord-Wise access for type LWORD must be in the range 0..1", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 106 }..TextLocation { line: 5, column: 21, offset: 109 }) }], err_no: type__incompatible_directaccess_range } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__reference_direct_access_only_with_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__reference_direct_access_only_with_ints.snap index 0586ff36ca..e613224530 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__reference_direct_access_only_with_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__reference_direct_access_only_with_ints.snap @@ -2,6 +2,6 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Invalid type LREAL for direct variable access. Only variables of Integer types are allowed", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 160 }..TextLocation { line: 6, column: 21, offset: 163 }) }], err_no: type__incompatible_directaccess_variable } -SyntaxError { message: "Invalid type REAL for direct variable access. Only variables of Integer types are allowed", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 18, offset: 183 }..TextLocation { line: 7, column: 21, offset: 186 }) }], err_no: type__incompatible_directaccess_variable } +SyntaxError { message: "Invalid type LREAL for direct variable access. Only variables of Integer types are allowed", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 159 }..TextLocation { line: 6, column: 21, offset: 162 }) }], err_no: type__incompatible_directaccess_variable } +SyntaxError { message: "Invalid type REAL for direct variable access. Only variables of Integer types are allowed", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 18, offset: 182 }..TextLocation { line: 7, column: 21, offset: 185 }) }], err_no: type__incompatible_directaccess_variable } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_only_on_bigger_sizes.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_only_on_bigger_sizes.snap index 8c11ae7609..2713560021 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_only_on_bigger_sizes.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_only_on_bigger_sizes.snap @@ -2,7 +2,7 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Word-Wise access requires a Numerical type larger than 16 bits", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 20, offset: 194 }..TextLocation { line: 9, column: 23, offset: 197 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "Word-Wise access requires a Numerical type larger than 16 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 220 }..TextLocation { line: 10, column: 24, offset: 223 }) }], err_no: type__incompatible_directaccess } -SyntaxError { message: "Word-Wise access requires a Numerical type larger than 16 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 246 }..TextLocation { line: 11, column: 24, offset: 249 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Word-Wise access requires a Numerical type larger than 16 bits", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 20, offset: 193 }..TextLocation { line: 9, column: 23, offset: 196 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Word-Wise access requires a Numerical type larger than 16 bits", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 21, offset: 219 }..TextLocation { line: 10, column: 24, offset: 222 }) }], err_no: type__incompatible_directaccess } +SyntaxError { message: "Word-Wise access requires a Numerical type larger than 16 bits", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 21, offset: 245 }..TextLocation { line: 11, column: 24, offset: 248 }) }], err_no: type__incompatible_directaccess } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap index 4837fa59d9..568aac496f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__bitaccess_validation_test__wordaccess_range_test.snap @@ -2,6 +2,6 @@ source: src/validation/tests/bitaccess_validation_test.rs expression: res --- -SyntaxError { message: "Word-Wise access for type DWORD must be in the range 0..1", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 118 }..TextLocation { line: 5, column: 21, offset: 121 }) }], err_no: type__incompatible_directaccess_range } -SyntaxError { message: "Word-Wise access for type LWORD must be in the range 0..3", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 141 }..TextLocation { line: 6, column: 21, offset: 144 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Word-Wise access for type DWORD must be in the range 0..1", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 18, offset: 117 }..TextLocation { line: 5, column: 21, offset: 120 }) }], err_no: type__incompatible_directaccess_range } +SyntaxError { message: "Word-Wise access for type LWORD must be in the range 0..3", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 18, offset: 140 }..TextLocation { line: 6, column: 21, offset: 143 }) }], err_no: type__incompatible_directaccess_range } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__duplicates_validation_test__duplicate_action_should_be_a_problem.snap b/src/validation/tests/snapshots/rusty__validation__tests__duplicates_validation_test__duplicate_action_should_be_a_problem.snap index e7cdf31da3..ac1ddf51bc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__duplicates_validation_test__duplicate_action_should_be_a_problem.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__duplicates_validation_test__duplicate_action_should_be_a_problem.snap @@ -2,6 +2,6 @@ source: src/validation/tests/duplicates_validation_test.rs expression: res --- -SyntaxError { message: "prg.foo: Ambiguous callable symbol.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 19, offset: 168 }..TextLocation { line: 8, column: 22, offset: 171 }) }, SourceLocation { span: Range(TextLocation { line: 16, column: 19, offset: 310 }..TextLocation { line: 16, column: 22, offset: 313 }) }], err_no: duplicate_symbol } -SyntaxError { message: "prg.foo: Ambiguous callable symbol.", range: [SourceLocation { span: Range(TextLocation { line: 16, column: 19, offset: 310 }..TextLocation { line: 16, column: 22, offset: 313 }) }, SourceLocation { span: Range(TextLocation { line: 8, column: 19, offset: 168 }..TextLocation { line: 8, column: 22, offset: 171 }) }], err_no: duplicate_symbol } +SyntaxError { message: "prg.foo: Ambiguous callable symbol.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 19, offset: 167 }..TextLocation { line: 8, column: 22, offset: 170 }) }, SourceLocation { span: Range(TextLocation { line: 16, column: 19, offset: 309 }..TextLocation { line: 16, column: 22, offset: 312 }) }], err_no: duplicate_symbol } +SyntaxError { message: "prg.foo: Ambiguous callable symbol.", range: [SourceLocation { span: Range(TextLocation { line: 16, column: 19, offset: 309 }..TextLocation { line: 16, column: 22, offset: 312 }) }, SourceLocation { span: Range(TextLocation { line: 8, column: 19, offset: 167 }..TextLocation { line: 8, column: 22, offset: 170 }) }], err_no: duplicate_symbol } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap index d149b5c152..e6b58999b4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'BOOL'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'BOOL'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 206 }..TextLocation { line: 3, column: 53, offset: 207 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 206 }..TextLocation { line: 3, column: 53, offset: 207 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'BOOL'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 212 }..TextLocation { line: 3, column: 59, offset: 213 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 212 }..TextLocation { line: 3, column: 59, offset: 213 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap index a17645d4a4..237bef9b7c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_date.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 135 }..TextLocation { line: 2, column: 56, offset: 136 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 202 }..TextLocation { line: 3, column: 51, offset: 203 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 270 }..TextLocation { line: 4, column: 52, offset: 271 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 337 }..TextLocation { line: 5, column: 51, offset: 338 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 405 }..TextLocation { line: 6, column: 52, offset: 406 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 208 }..TextLocation { line: 3, column: 57, offset: 209 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 282 }..TextLocation { line: 4, column: 58, offset: 283 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 355 }..TextLocation { line: 5, column: 57, offset: 356 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 429 }..TextLocation { line: 6, column: 58, offset: 430 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap index beb147c098..247d3ad4ba 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_ints.snap @@ -2,12 +2,12 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid type nature for generic argument. USINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 133 }..TextLocation { line: 3, column: 53, offset: 134 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 207 }..TextLocation { line: 4, column: 58, offset: 208 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 276 }..TextLocation { line: 5, column: 53, offset: 277 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 345 }..TextLocation { line: 6, column: 53, offset: 346 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. SINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 414 }..TextLocation { line: 8, column: 52, offset: 415 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. INT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 487 }..TextLocation { line: 9, column: 57, offset: 488 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 555 }..TextLocation { line: 10, column: 52, offset: 556 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 623 }..TextLocation { line: 11, column: 52, offset: 624 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 139 }..TextLocation { line: 3, column: 59, offset: 140 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 213 }..TextLocation { line: 4, column: 58, offset: 214 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 288 }..TextLocation { line: 5, column: 59, offset: 289 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 363 }..TextLocation { line: 6, column: 59, offset: 364 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 438 }..TextLocation { line: 8, column: 58, offset: 439 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. INT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 511 }..TextLocation { line: 9, column: 57, offset: 512 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 585 }..TextLocation { line: 10, column: 58, offset: 586 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 659 }..TextLocation { line: 11, column: 58, offset: 660 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap index 20147c3587..a15b9832f1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_bit_does_not_allow_time.snap @@ -3,5 +3,5 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. TIME is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 206 }..TextLocation { line: 3, column: 53, offset: 207 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Bit.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 212 }..TextLocation { line: 3, column: 59, offset: 213 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap index 8d97ebf741..a9179b1af6 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_bits.snap @@ -4,12 +4,12 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'BOOL' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'BYTE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 206 }..TextLocation { line: 3, column: 52, offset: 207 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 206 }..TextLocation { line: 3, column: 52, offset: 207 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 274 }..TextLocation { line: 4, column: 52, offset: 275 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 274 }..TextLocation { line: 4, column: 52, offset: 275 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 343 }..TextLocation { line: 5, column: 53, offset: 344 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 343 }..TextLocation { line: 5, column: 53, offset: 344 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'LWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 412 }..TextLocation { line: 6, column: 53, offset: 413 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 412 }..TextLocation { line: 6, column: 53, offset: 413 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'BYTE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 212 }..TextLocation { line: 3, column: 58, offset: 213 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 212 }..TextLocation { line: 3, column: 58, offset: 213 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 286 }..TextLocation { line: 4, column: 58, offset: 287 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 286 }..TextLocation { line: 4, column: 58, offset: 287 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 361 }..TextLocation { line: 5, column: 59, offset: 362 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 361 }..TextLocation { line: 5, column: 59, offset: 362 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'LWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 436 }..TextLocation { line: 6, column: 59, offset: 437 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 436 }..TextLocation { line: 6, column: 59, offset: 437 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap index 1be04ad156..eff0b3584f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_date.snap @@ -4,12 +4,12 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 136 }..TextLocation { line: 2, column: 56, offset: 137 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 136 }..TextLocation { line: 2, column: 56, offset: 137 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 203 }..TextLocation { line: 3, column: 51, offset: 204 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 203 }..TextLocation { line: 3, column: 51, offset: 204 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DATE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 271 }..TextLocation { line: 4, column: 52, offset: 272 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 271 }..TextLocation { line: 4, column: 52, offset: 272 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 338 }..TextLocation { line: 5, column: 51, offset: 339 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 338 }..TextLocation { line: 5, column: 51, offset: 339 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 406 }..TextLocation { line: 6, column: 52, offset: 407 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 406 }..TextLocation { line: 6, column: 52, offset: 407 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 209 }..TextLocation { line: 3, column: 57, offset: 210 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 209 }..TextLocation { line: 3, column: 57, offset: 210 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DATE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 283 }..TextLocation { line: 4, column: 58, offset: 284 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 283 }..TextLocation { line: 4, column: 58, offset: 284 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 356 }..TextLocation { line: 5, column: 57, offset: 357 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 356 }..TextLocation { line: 5, column: 57, offset: 357 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 430 }..TextLocation { line: 6, column: 58, offset: 431 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 430 }..TextLocation { line: 6, column: 58, offset: 431 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap index 1d08ddb86e..989627379e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_ints.snap @@ -2,20 +2,20 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'USINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 134 }..TextLocation { line: 3, column: 53, offset: 135 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. USINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 134 }..TextLocation { line: 3, column: 53, offset: 135 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'UINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 208 }..TextLocation { line: 4, column: 58, offset: 209 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 208 }..TextLocation { line: 4, column: 58, offset: 209 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 277 }..TextLocation { line: 5, column: 53, offset: 278 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 277 }..TextLocation { line: 5, column: 53, offset: 278 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'ULINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 346 }..TextLocation { line: 6, column: 53, offset: 347 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 346 }..TextLocation { line: 6, column: 53, offset: 347 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'SINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 415 }..TextLocation { line: 8, column: 52, offset: 416 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. SINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 415 }..TextLocation { line: 8, column: 52, offset: 416 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 488 }..TextLocation { line: 9, column: 57, offset: 489 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. INT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 488 }..TextLocation { line: 9, column: 57, offset: 489 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 556 }..TextLocation { line: 10, column: 52, offset: 557 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 556 }..TextLocation { line: 10, column: 52, offset: 557 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'LINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 624 }..TextLocation { line: 11, column: 52, offset: 625 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 624 }..TextLocation { line: 11, column: 52, offset: 625 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'USINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 140 }..TextLocation { line: 3, column: 59, offset: 141 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 140 }..TextLocation { line: 3, column: 59, offset: 141 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'UINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 214 }..TextLocation { line: 4, column: 58, offset: 215 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 214 }..TextLocation { line: 4, column: 58, offset: 215 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 289 }..TextLocation { line: 5, column: 59, offset: 290 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 289 }..TextLocation { line: 5, column: 59, offset: 290 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'ULINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 364 }..TextLocation { line: 6, column: 59, offset: 365 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 364 }..TextLocation { line: 6, column: 59, offset: 365 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'SINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 439 }..TextLocation { line: 8, column: 58, offset: 440 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 439 }..TextLocation { line: 8, column: 58, offset: 440 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 512 }..TextLocation { line: 9, column: 57, offset: 513 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. INT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 512 }..TextLocation { line: 9, column: 57, offset: 513 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 586 }..TextLocation { line: 10, column: 58, offset: 587 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 586 }..TextLocation { line: 10, column: 58, offset: 587 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'LINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 660 }..TextLocation { line: 11, column: 58, offset: 661 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 660 }..TextLocation { line: 11, column: 58, offset: 661 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap index 4344c341fc..0683c8046c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_char_does_not_allow_time.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. TIME is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Char.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap index 3659415195..8b5f560bb7 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_bits.snap @@ -4,12 +4,12 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'BOOL' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 139 }..TextLocation { line: 2, column: 58, offset: 140 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 139 }..TextLocation { line: 2, column: 58, offset: 140 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'BYTE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 207 }..TextLocation { line: 3, column: 52, offset: 208 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 207 }..TextLocation { line: 3, column: 52, offset: 208 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 275 }..TextLocation { line: 4, column: 52, offset: 276 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 275 }..TextLocation { line: 4, column: 52, offset: 276 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 344 }..TextLocation { line: 5, column: 53, offset: 345 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 344 }..TextLocation { line: 5, column: 53, offset: 345 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'LWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 413 }..TextLocation { line: 6, column: 53, offset: 414 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 413 }..TextLocation { line: 6, column: 53, offset: 414 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'BYTE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 213 }..TextLocation { line: 3, column: 58, offset: 214 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 213 }..TextLocation { line: 3, column: 58, offset: 214 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 287 }..TextLocation { line: 4, column: 58, offset: 288 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 287 }..TextLocation { line: 4, column: 58, offset: 288 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 362 }..TextLocation { line: 5, column: 59, offset: 363 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 362 }..TextLocation { line: 5, column: 59, offset: 363 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'LWORD' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 437 }..TextLocation { line: 6, column: 59, offset: 438 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 437 }..TextLocation { line: 6, column: 59, offset: 438 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap index da6dc67691..2d80369825 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_date.snap @@ -4,12 +4,12 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 137 }..TextLocation { line: 2, column: 56, offset: 138 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 137 }..TextLocation { line: 2, column: 56, offset: 138 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 204 }..TextLocation { line: 3, column: 51, offset: 205 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 204 }..TextLocation { line: 3, column: 51, offset: 205 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DATE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 272 }..TextLocation { line: 4, column: 52, offset: 273 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 272 }..TextLocation { line: 4, column: 52, offset: 273 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 339 }..TextLocation { line: 5, column: 51, offset: 340 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 339 }..TextLocation { line: 5, column: 51, offset: 340 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 407 }..TextLocation { line: 6, column: 52, offset: 408 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 407 }..TextLocation { line: 6, column: 52, offset: 408 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 210 }..TextLocation { line: 3, column: 57, offset: 211 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 210 }..TextLocation { line: 3, column: 57, offset: 211 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DATE' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 284 }..TextLocation { line: 4, column: 58, offset: 285 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 284 }..TextLocation { line: 4, column: 58, offset: 285 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 357 }..TextLocation { line: 5, column: 57, offset: 358 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 357 }..TextLocation { line: 5, column: 57, offset: 358 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 431 }..TextLocation { line: 6, column: 58, offset: 432 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 431 }..TextLocation { line: 6, column: 58, offset: 432 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap index 05f4c88d56..f5c8601f0b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_ints.snap @@ -2,20 +2,20 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'USINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 135 }..TextLocation { line: 3, column: 53, offset: 136 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. USINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 135 }..TextLocation { line: 3, column: 53, offset: 136 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'UINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 209 }..TextLocation { line: 4, column: 58, offset: 210 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 209 }..TextLocation { line: 4, column: 58, offset: 210 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 278 }..TextLocation { line: 5, column: 53, offset: 279 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 278 }..TextLocation { line: 5, column: 53, offset: 279 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'ULINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 347 }..TextLocation { line: 6, column: 53, offset: 348 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 347 }..TextLocation { line: 6, column: 53, offset: 348 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'SINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 416 }..TextLocation { line: 8, column: 52, offset: 417 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. SINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 416 }..TextLocation { line: 8, column: 52, offset: 417 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 489 }..TextLocation { line: 9, column: 57, offset: 490 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. INT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 489 }..TextLocation { line: 9, column: 57, offset: 490 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 557 }..TextLocation { line: 10, column: 52, offset: 558 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 557 }..TextLocation { line: 10, column: 52, offset: 558 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'LINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 625 }..TextLocation { line: 11, column: 52, offset: 626 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 625 }..TextLocation { line: 11, column: 52, offset: 626 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'USINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 141 }..TextLocation { line: 3, column: 59, offset: 142 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 141 }..TextLocation { line: 3, column: 59, offset: 142 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'UINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 215 }..TextLocation { line: 4, column: 58, offset: 216 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 215 }..TextLocation { line: 4, column: 58, offset: 216 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 290 }..TextLocation { line: 5, column: 59, offset: 291 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 290 }..TextLocation { line: 5, column: 59, offset: 291 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'ULINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 365 }..TextLocation { line: 6, column: 59, offset: 366 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 365 }..TextLocation { line: 6, column: 59, offset: 366 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'SINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 440 }..TextLocation { line: 8, column: 58, offset: 441 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 440 }..TextLocation { line: 8, column: 58, offset: 441 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 513 }..TextLocation { line: 9, column: 57, offset: 514 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. INT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 513 }..TextLocation { line: 9, column: 57, offset: 514 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 587 }..TextLocation { line: 10, column: 58, offset: 588 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 587 }..TextLocation { line: 10, column: 58, offset: 588 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'LINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 661 }..TextLocation { line: 11, column: 58, offset: 662 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 661 }..TextLocation { line: 11, column: 58, offset: 662 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap index d1114fec01..1c2fceb8c2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_chars_does_not_allow_time.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 139 }..TextLocation { line: 2, column: 58, offset: 140 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. TIME is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 139 }..TextLocation { line: 2, column: 58, offset: 140 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 208 }..TextLocation { line: 3, column: 53, offset: 209 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 208 }..TextLocation { line: 3, column: 53, offset: 209 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 214 }..TextLocation { line: 3, column: 59, offset: 215 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Chars.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 214 }..TextLocation { line: 3, column: 59, offset: 215 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap index 9a502a838e..65ab24f356 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_bits.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 206 }..TextLocation { line: 3, column: 52, offset: 207 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 274 }..TextLocation { line: 4, column: 52, offset: 275 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 343 }..TextLocation { line: 5, column: 53, offset: 344 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 412 }..TextLocation { line: 6, column: 53, offset: 413 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 212 }..TextLocation { line: 3, column: 58, offset: 213 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 286 }..TextLocation { line: 4, column: 58, offset: 287 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 361 }..TextLocation { line: 5, column: 59, offset: 362 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 436 }..TextLocation { line: 6, column: 59, offset: 437 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap index 9bd1db826f..9e8bbce461 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'DATE'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap index ad82e89f3f..41fce0ed7d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_ints.snap @@ -2,12 +2,12 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid type nature for generic argument. USINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 134 }..TextLocation { line: 3, column: 53, offset: 135 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 208 }..TextLocation { line: 4, column: 58, offset: 209 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 277 }..TextLocation { line: 5, column: 53, offset: 278 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 346 }..TextLocation { line: 6, column: 53, offset: 347 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. SINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 415 }..TextLocation { line: 8, column: 52, offset: 416 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. INT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 488 }..TextLocation { line: 9, column: 57, offset: 489 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 556 }..TextLocation { line: 10, column: 52, offset: 557 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 624 }..TextLocation { line: 11, column: 52, offset: 625 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 140 }..TextLocation { line: 3, column: 59, offset: 141 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 214 }..TextLocation { line: 4, column: 58, offset: 215 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 289 }..TextLocation { line: 5, column: 59, offset: 290 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 364 }..TextLocation { line: 6, column: 59, offset: 365 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 439 }..TextLocation { line: 8, column: 58, offset: 440 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. INT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 512 }..TextLocation { line: 9, column: 57, offset: 513 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 586 }..TextLocation { line: 10, column: 58, offset: 587 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 660 }..TextLocation { line: 11, column: 58, offset: 661 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap index 97a763d929..4dd3ed2327 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_date_does_not_allow_time.snap @@ -3,5 +3,5 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. TIME is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Date.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap index 26d980f897..4879a7153e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_bits.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 210 }..TextLocation { line: 3, column: 52, offset: 211 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 278 }..TextLocation { line: 4, column: 52, offset: 279 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 347 }..TextLocation { line: 5, column: 53, offset: 348 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 416 }..TextLocation { line: 6, column: 53, offset: 417 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 216 }..TextLocation { line: 3, column: 58, offset: 217 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 290 }..TextLocation { line: 4, column: 58, offset: 291 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 365 }..TextLocation { line: 5, column: 59, offset: 366 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 440 }..TextLocation { line: 6, column: 59, offset: 441 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap index b9e6712662..c338874d39 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 211 }..TextLocation { line: 3, column: 53, offset: 212 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 211 }..TextLocation { line: 3, column: 53, offset: 212 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'TIME'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 217 }..TextLocation { line: 3, column: 59, offset: 218 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 217 }..TextLocation { line: 3, column: 59, offset: 218 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap index 798797a67d..ee99dbfb04 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_date.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 140 }..TextLocation { line: 2, column: 56, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 207 }..TextLocation { line: 3, column: 51, offset: 208 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 275 }..TextLocation { line: 4, column: 52, offset: 276 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 342 }..TextLocation { line: 5, column: 51, offset: 343 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 410 }..TextLocation { line: 6, column: 52, offset: 411 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 213 }..TextLocation { line: 3, column: 57, offset: 214 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 287 }..TextLocation { line: 4, column: 58, offset: 288 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 360 }..TextLocation { line: 5, column: 57, offset: 361 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 434 }..TextLocation { line: 6, column: 58, offset: 435 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap index 693b346c10..d4123709c4 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_duration_does_not_allow_ints.snap @@ -2,12 +2,12 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid type nature for generic argument. USINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 138 }..TextLocation { line: 3, column: 53, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 212 }..TextLocation { line: 4, column: 58, offset: 213 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 281 }..TextLocation { line: 5, column: 53, offset: 282 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 350 }..TextLocation { line: 6, column: 53, offset: 351 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. SINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 419 }..TextLocation { line: 8, column: 52, offset: 420 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. INT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 492 }..TextLocation { line: 9, column: 57, offset: 493 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 560 }..TextLocation { line: 10, column: 52, offset: 561 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 628 }..TextLocation { line: 11, column: 52, offset: 629 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 144 }..TextLocation { line: 3, column: 59, offset: 145 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 218 }..TextLocation { line: 4, column: 58, offset: 219 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 293 }..TextLocation { line: 5, column: 59, offset: 294 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 368 }..TextLocation { line: 6, column: 59, offset: 369 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 443 }..TextLocation { line: 8, column: 58, offset: 444 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. INT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 516 }..TextLocation { line: 9, column: 57, offset: 517 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 590 }..TextLocation { line: 10, column: 58, offset: 591 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no Duration.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 664 }..TextLocation { line: 11, column: 58, offset: 665 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap index 1f95e0c757..e4892529d3 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_bits.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 205 }..TextLocation { line: 3, column: 52, offset: 206 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 273 }..TextLocation { line: 4, column: 52, offset: 274 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 342 }..TextLocation { line: 5, column: 53, offset: 343 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 411 }..TextLocation { line: 6, column: 53, offset: 412 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 211 }..TextLocation { line: 3, column: 58, offset: 212 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 285 }..TextLocation { line: 4, column: 58, offset: 286 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 360 }..TextLocation { line: 5, column: 59, offset: 361 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 435 }..TextLocation { line: 6, column: 59, offset: 436 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap index 4b73ac753d..f02d63128b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'USINT'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'USINT'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 206 }..TextLocation { line: 3, column: 53, offset: 207 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 206 }..TextLocation { line: 3, column: 53, offset: 207 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'USINT'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 212 }..TextLocation { line: 3, column: 59, offset: 213 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 212 }..TextLocation { line: 3, column: 59, offset: 213 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap index 7d5c2c4343..7805d19cbe 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_date.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 135 }..TextLocation { line: 2, column: 56, offset: 136 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 202 }..TextLocation { line: 3, column: 51, offset: 203 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 270 }..TextLocation { line: 4, column: 52, offset: 271 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 337 }..TextLocation { line: 5, column: 51, offset: 338 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 405 }..TextLocation { line: 6, column: 52, offset: 406 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 208 }..TextLocation { line: 3, column: 57, offset: 209 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 282 }..TextLocation { line: 4, column: 58, offset: 283 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 355 }..TextLocation { line: 5, column: 57, offset: 356 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 429 }..TextLocation { line: 6, column: 58, offset: 430 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap index 1ff452289e..5347962903 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_int_does_not_allow_time.snap @@ -3,5 +3,5 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 206 }..TextLocation { line: 3, column: 53, offset: 207 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 212 }..TextLocation { line: 3, column: 59, offset: 213 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap index df38af0ebf..bda566f733 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_bits.snap @@ -4,7 +4,7 @@ expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 143 }..TextLocation { line: 2, column: 58, offset: 144 }) }], err_no: type__invalid_nature } SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 217 }..TextLocation { line: 3, column: 58, offset: 218 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 285 }..TextLocation { line: 4, column: 52, offset: 286 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 360 }..TextLocation { line: 5, column: 59, offset: 361 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 429 }..TextLocation { line: 6, column: 53, offset: 430 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 291 }..TextLocation { line: 4, column: 58, offset: 292 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 366 }..TextLocation { line: 5, column: 59, offset: 367 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 441 }..TextLocation { line: 6, column: 59, offset: 442 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap index f312875d57..d93f7b9e7c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_magnitude_does_not_allow_date.snap @@ -4,7 +4,7 @@ expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 141 }..TextLocation { line: 2, column: 56, offset: 142 }) }], err_no: type__invalid_nature } SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 214 }..TextLocation { line: 3, column: 57, offset: 215 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 282 }..TextLocation { line: 4, column: 52, offset: 283 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 355 }..TextLocation { line: 5, column: 57, offset: 356 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 423 }..TextLocation { line: 6, column: 52, offset: 424 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 288 }..TextLocation { line: 4, column: 58, offset: 289 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 361 }..TextLocation { line: 5, column: 57, offset: 362 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Magnitude.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 435 }..TextLocation { line: 6, column: 58, offset: 436 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap index c0abdecbe9..549a365dd8 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_bits.snap @@ -4,7 +4,7 @@ expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 137 }..TextLocation { line: 2, column: 58, offset: 138 }) }], err_no: type__invalid_nature } SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 211 }..TextLocation { line: 3, column: 58, offset: 212 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 279 }..TextLocation { line: 4, column: 52, offset: 280 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 354 }..TextLocation { line: 5, column: 59, offset: 355 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 423 }..TextLocation { line: 6, column: 53, offset: 424 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 285 }..TextLocation { line: 4, column: 58, offset: 286 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 360 }..TextLocation { line: 5, column: 59, offset: 361 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 435 }..TextLocation { line: 6, column: 59, offset: 436 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap index 8e11977369..39b7a32eed 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_num_does_not_allow_date.snap @@ -4,7 +4,7 @@ expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 135 }..TextLocation { line: 2, column: 56, offset: 136 }) }], err_no: type__invalid_nature } SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 208 }..TextLocation { line: 3, column: 57, offset: 209 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 276 }..TextLocation { line: 4, column: 52, offset: 277 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 349 }..TextLocation { line: 5, column: 57, offset: 350 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 417 }..TextLocation { line: 6, column: 52, offset: 418 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 282 }..TextLocation { line: 4, column: 58, offset: 283 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 355 }..TextLocation { line: 5, column: 57, offset: 356 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Num.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 429 }..TextLocation { line: 6, column: 58, offset: 430 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap index 207f40c7f0..89e7550982 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_bits.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 206 }..TextLocation { line: 3, column: 52, offset: 207 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 274 }..TextLocation { line: 4, column: 52, offset: 275 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 343 }..TextLocation { line: 5, column: 53, offset: 344 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 412 }..TextLocation { line: 6, column: 53, offset: 413 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 212 }..TextLocation { line: 3, column: 58, offset: 213 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 286 }..TextLocation { line: 4, column: 58, offset: 287 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 361 }..TextLocation { line: 5, column: 59, offset: 362 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 436 }..TextLocation { line: 6, column: 59, offset: 437 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap index 309b1aed9f..e7853d2ce5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'REAL'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap index 4bb4a372e6..31fc52d197 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_date.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 136 }..TextLocation { line: 2, column: 56, offset: 137 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 203 }..TextLocation { line: 3, column: 51, offset: 204 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 271 }..TextLocation { line: 4, column: 52, offset: 272 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 338 }..TextLocation { line: 5, column: 51, offset: 339 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 406 }..TextLocation { line: 6, column: 52, offset: 407 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 209 }..TextLocation { line: 3, column: 57, offset: 210 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 283 }..TextLocation { line: 4, column: 58, offset: 284 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 356 }..TextLocation { line: 5, column: 57, offset: 357 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 430 }..TextLocation { line: 6, column: 58, offset: 431 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap index 9b0f72d426..1a45686ba3 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_real_does_not_allow_time.snap @@ -3,5 +3,5 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. TIME is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 138 }..TextLocation { line: 2, column: 58, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 207 }..TextLocation { line: 3, column: 53, offset: 208 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Real.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 213 }..TextLocation { line: 3, column: 59, offset: 214 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap index 8ef232087a..8cfcae02e7 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_bits.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 208 }..TextLocation { line: 3, column: 52, offset: 209 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 276 }..TextLocation { line: 4, column: 52, offset: 277 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 345 }..TextLocation { line: 5, column: 53, offset: 346 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 414 }..TextLocation { line: 6, column: 53, offset: 415 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 214 }..TextLocation { line: 3, column: 58, offset: 215 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 288 }..TextLocation { line: 4, column: 58, offset: 289 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 363 }..TextLocation { line: 5, column: 59, offset: 364 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 438 }..TextLocation { line: 6, column: 59, offset: 439 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap index 995e9556e6..2a3755c4f5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'SINT'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'SINT'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'SINT'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap index a4281f084d..27bf8b80cd 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_date.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 138 }..TextLocation { line: 2, column: 56, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 205 }..TextLocation { line: 3, column: 51, offset: 206 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 273 }..TextLocation { line: 4, column: 52, offset: 274 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 340 }..TextLocation { line: 5, column: 51, offset: 341 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 408 }..TextLocation { line: 6, column: 52, offset: 409 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 211 }..TextLocation { line: 3, column: 57, offset: 212 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 285 }..TextLocation { line: 4, column: 58, offset: 286 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 358 }..TextLocation { line: 5, column: 57, offset: 359 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 432 }..TextLocation { line: 6, column: 58, offset: 433 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap index 27663b3b69..ed44095305 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_time.snap @@ -3,5 +3,5 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. TIME is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap index 8c96bb8493..dae2f20f80 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_signed_does_not_allow_unsigned_ints.snap @@ -2,8 +2,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid type nature for generic argument. USINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 52, offset: 135 }..TextLocation { line: 2, column: 53, offset: 136 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 209 }..TextLocation { line: 3, column: 58, offset: 210 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 52, offset: 278 }..TextLocation { line: 4, column: 53, offset: 279 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 347 }..TextLocation { line: 5, column: 53, offset: 348 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 58, offset: 141 }..TextLocation { line: 2, column: 59, offset: 142 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 215 }..TextLocation { line: 3, column: 58, offset: 216 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 58, offset: 290 }..TextLocation { line: 4, column: 59, offset: 291 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no Signed.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 365 }..TextLocation { line: 5, column: 59, offset: 366 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap index 2ddfec1848..11c387aaa2 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_bits.snap @@ -4,12 +4,12 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'BOOL' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. BOOL is no String.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'BYTE' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 208 }..TextLocation { line: 3, column: 52, offset: 209 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 208 }..TextLocation { line: 3, column: 52, offset: 209 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 276 }..TextLocation { line: 4, column: 52, offset: 277 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no String.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 276 }..TextLocation { line: 4, column: 52, offset: 277 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 345 }..TextLocation { line: 5, column: 53, offset: 346 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no String.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 345 }..TextLocation { line: 5, column: 53, offset: 346 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'LWORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 414 }..TextLocation { line: 6, column: 53, offset: 415 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no String.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 414 }..TextLocation { line: 6, column: 53, offset: 415 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'BYTE' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 214 }..TextLocation { line: 3, column: 58, offset: 215 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 214 }..TextLocation { line: 3, column: 58, offset: 215 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 288 }..TextLocation { line: 4, column: 58, offset: 289 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no String.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 288 }..TextLocation { line: 4, column: 58, offset: 289 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 363 }..TextLocation { line: 5, column: 59, offset: 364 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no String.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 363 }..TextLocation { line: 5, column: 59, offset: 364 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'LWORD' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 438 }..TextLocation { line: 6, column: 59, offset: 439 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no String.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 438 }..TextLocation { line: 6, column: 59, offset: 439 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap index 23d8821f85..9c182c5061 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no String.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap index c3beee6bcb..3eb8916b5c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_date.snap @@ -4,12 +4,12 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 138 }..TextLocation { line: 2, column: 56, offset: 139 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no String.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 138 }..TextLocation { line: 2, column: 56, offset: 139 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 205 }..TextLocation { line: 3, column: 51, offset: 206 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 205 }..TextLocation { line: 3, column: 51, offset: 206 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DATE' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 273 }..TextLocation { line: 4, column: 52, offset: 274 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no String.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 273 }..TextLocation { line: 4, column: 52, offset: 274 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 340 }..TextLocation { line: 5, column: 51, offset: 341 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no String.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 340 }..TextLocation { line: 5, column: 51, offset: 341 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 408 }..TextLocation { line: 6, column: 52, offset: 409 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no String.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 408 }..TextLocation { line: 6, column: 52, offset: 409 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DATE_AND_TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 211 }..TextLocation { line: 3, column: 57, offset: 212 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 211 }..TextLocation { line: 3, column: 57, offset: 212 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DATE' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 285 }..TextLocation { line: 4, column: 58, offset: 286 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no String.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 285 }..TextLocation { line: 4, column: 58, offset: 286 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 358 }..TextLocation { line: 5, column: 57, offset: 359 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no String.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 358 }..TextLocation { line: 5, column: 57, offset: 359 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME_OF_DAY' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 432 }..TextLocation { line: 6, column: 58, offset: 433 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no String.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 432 }..TextLocation { line: 6, column: 58, offset: 433 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap index ea5b1db49a..f422281cd8 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_ints.snap @@ -2,20 +2,20 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign 'USINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 136 }..TextLocation { line: 3, column: 53, offset: 137 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. USINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 136 }..TextLocation { line: 3, column: 53, offset: 137 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'UINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 210 }..TextLocation { line: 4, column: 58, offset: 211 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. UINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 210 }..TextLocation { line: 4, column: 58, offset: 211 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 279 }..TextLocation { line: 5, column: 53, offset: 280 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. UDINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 279 }..TextLocation { line: 5, column: 53, offset: 280 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'ULINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 348 }..TextLocation { line: 6, column: 53, offset: 349 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. ULINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 348 }..TextLocation { line: 6, column: 53, offset: 349 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'SINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 417 }..TextLocation { line: 8, column: 52, offset: 418 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. SINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 51, offset: 417 }..TextLocation { line: 8, column: 52, offset: 418 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 490 }..TextLocation { line: 9, column: 57, offset: 491 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. INT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 490 }..TextLocation { line: 9, column: 57, offset: 491 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 558 }..TextLocation { line: 10, column: 52, offset: 559 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 51, offset: 558 }..TextLocation { line: 10, column: 52, offset: 559 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'LINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 626 }..TextLocation { line: 11, column: 52, offset: 627 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 51, offset: 626 }..TextLocation { line: 11, column: 52, offset: 627 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'USINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 142 }..TextLocation { line: 3, column: 59, offset: 143 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. USINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 142 }..TextLocation { line: 3, column: 59, offset: 143 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'UINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 216 }..TextLocation { line: 4, column: 58, offset: 217 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. UINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 216 }..TextLocation { line: 4, column: 58, offset: 217 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'UDINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 291 }..TextLocation { line: 5, column: 59, offset: 292 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. UDINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 291 }..TextLocation { line: 5, column: 59, offset: 292 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'ULINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 366 }..TextLocation { line: 6, column: 59, offset: 367 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. ULINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 366 }..TextLocation { line: 6, column: 59, offset: 367 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'SINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 441 }..TextLocation { line: 8, column: 58, offset: 442 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 57, offset: 441 }..TextLocation { line: 8, column: 58, offset: 442 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 514 }..TextLocation { line: 9, column: 57, offset: 515 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. INT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 56, offset: 514 }..TextLocation { line: 9, column: 57, offset: 515 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 588 }..TextLocation { line: 10, column: 58, offset: 589 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 57, offset: 588 }..TextLocation { line: 10, column: 58, offset: 589 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'LINT' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 662 }..TextLocation { line: 11, column: 58, offset: 663 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no String.", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 57, offset: 662 }..TextLocation { line: 11, column: 58, offset: 663 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap index e01dc5acd9..69895eaf1b 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_string_does_not_allow_time.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. TIME is no String.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 140 }..TextLocation { line: 2, column: 58, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 209 }..TextLocation { line: 3, column: 53, offset: 210 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'TIME' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no String.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 215 }..TextLocation { line: 3, column: 59, offset: 216 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap index fce21e9974..91c3f3106f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_bits.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. BOOL is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 51, offset: 210 }..TextLocation { line: 3, column: 52, offset: 211 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. WORD is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 278 }..TextLocation { line: 4, column: 52, offset: 279 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 52, offset: 347 }..TextLocation { line: 5, column: 53, offset: 348 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 52, offset: 416 }..TextLocation { line: 6, column: 53, offset: 417 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. BYTE is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 57, offset: 216 }..TextLocation { line: 3, column: 58, offset: 217 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. WORD is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 290 }..TextLocation { line: 4, column: 58, offset: 291 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DWORD is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 58, offset: 365 }..TextLocation { line: 5, column: 59, offset: 366 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LWORD is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 58, offset: 440 }..TextLocation { line: 6, column: 59, offset: 441 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap index 66b260f39b..b16d084c82 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_chars.snap @@ -4,6 +4,6 @@ expression: res --- SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'USINT'", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid type nature for generic argument. CHAR is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'USINT'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 211 }..TextLocation { line: 3, column: 53, offset: 212 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 211 }..TextLocation { line: 3, column: 53, offset: 212 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'USINT'", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 217 }..TextLocation { line: 3, column: 59, offset: 218 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid type nature for generic argument. WCHAR is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 217 }..TextLocation { line: 3, column: 59, offset: 218 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap index c8b0003104..379758d32c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_date.snap @@ -3,8 +3,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 55, offset: 140 }..TextLocation { line: 2, column: 56, offset: 141 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 50, offset: 207 }..TextLocation { line: 3, column: 51, offset: 208 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DATE is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 275 }..TextLocation { line: 4, column: 52, offset: 276 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 50, offset: 342 }..TextLocation { line: 5, column: 51, offset: 343 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 51, offset: 410 }..TextLocation { line: 6, column: 52, offset: 411 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE_AND_TIME is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 213 }..TextLocation { line: 3, column: 57, offset: 214 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DATE is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 287 }..TextLocation { line: 4, column: 58, offset: 288 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 56, offset: 360 }..TextLocation { line: 5, column: 57, offset: 361 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME_OF_DAY is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 57, offset: 434 }..TextLocation { line: 6, column: 58, offset: 435 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap index 002482de27..ed065d0218 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_signed_ints.snap @@ -2,8 +2,8 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid type nature for generic argument. SINT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 51, offset: 136 }..TextLocation { line: 2, column: 52, offset: 137 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. INT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 209 }..TextLocation { line: 3, column: 57, offset: 210 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. DINT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 51, offset: 277 }..TextLocation { line: 4, column: 52, offset: 278 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. LINT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 51, offset: 345 }..TextLocation { line: 5, column: 52, offset: 346 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. SINT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. INT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 56, offset: 215 }..TextLocation { line: 3, column: 57, offset: 216 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. DINT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 4, column: 57, offset: 289 }..TextLocation { line: 4, column: 58, offset: 290 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. LINT is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 57, offset: 363 }..TextLocation { line: 5, column: 58, offset: 364 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap index c246010e35..ccb44ea6a9 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__generic_validation_tests__any_unsigned_does_not_allow_time.snap @@ -3,5 +3,5 @@ source: src/validation/tests/generic_validation_tests.rs expression: res --- SyntaxError { message: "Invalid type nature for generic argument. TIME is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 2, column: 57, offset: 142 }..TextLocation { line: 2, column: 58, offset: 143 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 52, offset: 211 }..TextLocation { line: 3, column: 53, offset: 212 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Unsigned.", range: [SourceLocation { span: Range(TextLocation { line: 3, column: 58, offset: 217 }..TextLocation { line: 3, column: 59, offset: 218 }) }], err_no: type__invalid_nature } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__char_cast_validate.snap b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__char_cast_validate.snap index 6ad9ad93ce..ce38ccf074 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__char_cast_validate.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__char_cast_validate.snap @@ -2,6 +2,6 @@ source: src/validation/tests/literals_validation_tests.rs expression: res --- -SyntaxError { message: "Literal \"XY\" out of range (CHAR)", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 3, offset: 83 }..TextLocation { line: 6, column: 12, offset: 92 }) }], err_no: type__literal_out_of_range } -SyntaxError { message: "Literal 'YZ' out of range (WCHAR)", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 3, offset: 97 }..TextLocation { line: 7, column: 13, offset: 107 }) }], err_no: type__literal_out_of_range } +SyntaxError { message: "Literal \"XY\" out of range (CHAR)", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 12, offset: 80 }..TextLocation { line: 6, column: 21, offset: 89 }) }], err_no: type__literal_out_of_range } +SyntaxError { message: "Literal 'YZ' out of range (WCHAR)", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 12, offset: 103 }..TextLocation { line: 7, column: 22, offset: 113 }) }], err_no: type__literal_out_of_range } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap index 496fcacb12..51a2732755 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__literal_cast_with_non_literal.snap @@ -2,5 +2,5 @@ source: src/validation/tests/literals_validation_tests.rs expression: res --- -SyntaxError { message: "Expected literal", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 12, offset: 25 }..TextLocation { line: 1, column: 19, offset: 32 }) }], err_no: type__expected_literal } +SyntaxError { message: "Expected literal", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 12, offset: 24 }..TextLocation { line: 1, column: 19, offset: 31 }) }], err_no: type__expected_literal } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__real_literal_casts_are_validated.snap b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__real_literal_casts_are_validated.snap index f19f9a3f0b..18a43acb91 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__real_literal_casts_are_validated.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__real_literal_casts_are_validated.snap @@ -2,6 +2,6 @@ source: src/validation/tests/literals_validation_tests.rs expression: res --- -SyntaxError { message: "Literal '3.14' is not compatible to REAL", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 12, offset: 180 }..TextLocation { line: 10, column: 23, offset: 191 }) }], err_no: type__incompatible_literal_cast } -SyntaxError { message: "Literal \"3.14\" is not compatible to LREAL", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 252 }..TextLocation { line: 14, column: 24, offset: 264 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal '3.14' is not compatible to REAL", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 12, offset: 168 }..TextLocation { line: 10, column: 23, offset: 179 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal \"3.14\" is not compatible to LREAL", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 239 }..TextLocation { line: 14, column: 24, offset: 251 }) }], err_no: type__incompatible_literal_cast } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__string_literal_casts_are_validated.snap b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__string_literal_casts_are_validated.snap index 575232aab8..d25d3de01c 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__string_literal_casts_are_validated.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__literals_validation_tests__string_literal_casts_are_validated.snap @@ -2,10 +2,10 @@ source: src/validation/tests/literals_validation_tests.rs expression: res --- -SyntaxError { message: "Literal true is not compatible to STRING", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 12, offset: 102 }..TextLocation { line: 6, column: 23, offset: 113 }) }], err_no: type__incompatible_literal_cast } -SyntaxError { message: "Literal false is not compatible to WSTRING", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 12, offset: 127 }..TextLocation { line: 7, column: 25, offset: 140 }) }], err_no: type__incompatible_literal_cast } -SyntaxError { message: "Literal 22 is not compatible to STRING", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 12, offset: 155 }..TextLocation { line: 9, column: 21, offset: 164 }) }], err_no: type__incompatible_literal_cast } -SyntaxError { message: "Literal 33 is not compatible to WSTRING", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 12, offset: 178 }..TextLocation { line: 10, column: 22, offset: 188 }) }], err_no: type__incompatible_literal_cast } -SyntaxError { message: "Literal 3.14 is not compatible to STRING", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 12, offset: 203 }..TextLocation { line: 12, column: 23, offset: 214 }) }], err_no: type__incompatible_literal_cast } -SyntaxError { message: "Literal 1.0 is not compatible to WSTRING", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 12, offset: 228 }..TextLocation { line: 13, column: 23, offset: 239 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal true is not compatible to STRING", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 12, offset: 90 }..TextLocation { line: 6, column: 23, offset: 101 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal false is not compatible to WSTRING", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 12, offset: 115 }..TextLocation { line: 7, column: 25, offset: 128 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal 22 is not compatible to STRING", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 12, offset: 143 }..TextLocation { line: 9, column: 21, offset: 152 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal 33 is not compatible to WSTRING", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 12, offset: 166 }..TextLocation { line: 10, column: 22, offset: 176 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal 3.14 is not compatible to STRING", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 12, offset: 191 }..TextLocation { line: 12, column: 23, offset: 202 }) }], err_no: type__incompatible_literal_cast } +SyntaxError { message: "Literal 1.0 is not compatible to WSTRING", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 12, offset: 216 }..TextLocation { line: 13, column: 23, offset: 227 }) }], err_no: type__incompatible_literal_cast } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__class_has_implementation.snap b/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__class_has_implementation.snap index 8e5bfb0237..d9b8128c21 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__class_has_implementation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__pou_validation_tests__class_has_implementation.snap @@ -2,5 +2,5 @@ source: src/validation/tests/pou_validation_tests.rs expression: res --- -SyntaxError { message: "A class cannot have an implementation", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 12, offset: 90 }..TextLocation { line: 6, column: 17, offset: 122 }) }], err_no: syntax__generic_error } +SyntaxError { message: "A class cannot have an implementation", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 12, offset: 88 }..TextLocation { line: 6, column: 17, offset: 120 }) }], err_no: syntax__generic_error } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap index 18aa8ff5f4..3529627da3 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_bcb.snap @@ -2,5 +2,5 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `B -> C -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 17, offset: 129 }..TextLocation { line: 5, column: 18, offset: 130 }) }, SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 240 }..TextLocation { line: 9, column: 18, offset: 241 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `B -> C -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 17, offset: 117 }..TextLocation { line: 5, column: 18, offset: 118 }) }, SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 216 }..TextLocation { line: 9, column: 18, offset: 217 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap index 35de671eeb..3c359549d5 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__one_cycle_with_multiple_identical_members_aba.snap @@ -2,5 +2,5 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 197 }..TextLocation { line: 7, column: 18, offset: 198 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 196 }..TextLocation { line: 7, column: 18, offset: 197 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap index 31e015a92d..28beaa22eb 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_aa_and_aba.snap @@ -3,5 +3,5 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- SemanticError { message: "Recursive data structure `A -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }], err_no: pou__recursive_data_structure } -SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 6, column: 17, offset: 167 }..TextLocation { line: 6, column: 18, offset: 168 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 6, column: 17, offset: 155 }..TextLocation { line: 6, column: 18, offset: 156 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap index a7869f0ca3..5278172cbb 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__arrays__two_cycles_with_branch_input.snap @@ -2,6 +2,6 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `F -> G -> H -> I -> F` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 500 }..TextLocation { line: 21, column: 28, offset: 501 }) }, SourceLocation { span: Range(TextLocation { line: 28, column: 17, offset: 667 }..TextLocation { line: 28, column: 18, offset: 668 }) }, SourceLocation { span: Range(TextLocation { line: 32, column: 27, offset: 773 }..TextLocation { line: 32, column: 28, offset: 774 }) }, SourceLocation { span: Range(TextLocation { line: 38, column: 17, offset: 901 }..TextLocation { line: 38, column: 18, offset: 902 }) }], err_no: pou__recursive_data_structure } -SemanticError { message: "Recursive data structure `B -> C -> E -> F -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 156 }..TextLocation { line: 7, column: 18, offset: 157 }) }, SourceLocation { span: Range(TextLocation { line: 11, column: 27, offset: 250 }..TextLocation { line: 11, column: 28, offset: 251 }) }, SourceLocation { span: Range(TextLocation { line: 17, column: 17, offset: 378 }..TextLocation { line: 17, column: 18, offset: 379 }) }, SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 500 }..TextLocation { line: 21, column: 28, offset: 501 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `F -> G -> H -> I -> F` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 488 }..TextLocation { line: 21, column: 28, offset: 489 }) }, SourceLocation { span: Range(TextLocation { line: 28, column: 17, offset: 643 }..TextLocation { line: 28, column: 18, offset: 644 }) }, SourceLocation { span: Range(TextLocation { line: 32, column: 27, offset: 737 }..TextLocation { line: 32, column: 28, offset: 738 }) }, SourceLocation { span: Range(TextLocation { line: 38, column: 17, offset: 865 }..TextLocation { line: 38, column: 18, offset: 866 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `B -> C -> E -> F -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 156 }..TextLocation { line: 7, column: 18, offset: 157 }) }, SourceLocation { span: Range(TextLocation { line: 11, column: 27, offset: 250 }..TextLocation { line: 11, column: 28, offset: 251 }) }, SourceLocation { span: Range(TextLocation { line: 17, column: 17, offset: 378 }..TextLocation { line: 17, column: 18, offset: 379 }) }, SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 488 }..TextLocation { line: 21, column: 28, offset: 489 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap index 9575b9934c..d44e0ed07f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__functionblocks__two_cycles_with_branch_input.snap @@ -2,6 +2,6 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `F -> G -> H -> I -> F` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 27, offset: 592 }..TextLocation { line: 25, column: 28, offset: 593 }) }, SourceLocation { span: Range(TextLocation { line: 32, column: 27, offset: 769 }..TextLocation { line: 32, column: 28, offset: 770 }) }, SourceLocation { span: Range(TextLocation { line: 38, column: 27, offset: 919 }..TextLocation { line: 38, column: 28, offset: 920 }) }, SourceLocation { span: Range(TextLocation { line: 44, column: 27, offset: 1057 }..TextLocation { line: 44, column: 28, offset: 1058 }) }], err_no: pou__recursive_data_structure } -SemanticError { message: "Recursive data structure `B -> C -> E -> F -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 27, offset: 166 }..TextLocation { line: 7, column: 28, offset: 167 }) }, SourceLocation { span: Range(TextLocation { line: 13, column: 27, offset: 304 }..TextLocation { line: 13, column: 28, offset: 305 }) }, SourceLocation { span: Range(TextLocation { line: 19, column: 27, offset: 442 }..TextLocation { line: 19, column: 28, offset: 443 }) }, SourceLocation { span: Range(TextLocation { line: 25, column: 27, offset: 592 }..TextLocation { line: 25, column: 28, offset: 593 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `F -> G -> H -> I -> F` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 27, offset: 580 }..TextLocation { line: 25, column: 28, offset: 581 }) }, SourceLocation { span: Range(TextLocation { line: 32, column: 27, offset: 745 }..TextLocation { line: 32, column: 28, offset: 746 }) }, SourceLocation { span: Range(TextLocation { line: 38, column: 27, offset: 883 }..TextLocation { line: 38, column: 28, offset: 884 }) }, SourceLocation { span: Range(TextLocation { line: 44, column: 27, offset: 1021 }..TextLocation { line: 44, column: 28, offset: 1022 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `B -> C -> E -> F -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 27, offset: 166 }..TextLocation { line: 7, column: 28, offset: 167 }) }, SourceLocation { span: Range(TextLocation { line: 13, column: 27, offset: 304 }..TextLocation { line: 13, column: 28, offset: 305 }) }, SourceLocation { span: Range(TextLocation { line: 19, column: 27, offset: 442 }..TextLocation { line: 19, column: 28, offset: 443 }) }, SourceLocation { span: Range(TextLocation { line: 25, column: 27, offset: 580 }..TextLocation { line: 25, column: 28, offset: 581 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap index 6b78570d2b..1e2734e00f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__mixed_structs_and_functionblocks__two_cycles_with_branch_input.snap @@ -2,6 +2,6 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `F -> G -> H -> I -> F` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 484 }..TextLocation { line: 21, column: 28, offset: 485 }) }, SourceLocation { span: Range(TextLocation { line: 28, column: 17, offset: 651 }..TextLocation { line: 28, column: 18, offset: 652 }) }, SourceLocation { span: Range(TextLocation { line: 32, column: 27, offset: 757 }..TextLocation { line: 32, column: 28, offset: 758 }) }, SourceLocation { span: Range(TextLocation { line: 38, column: 17, offset: 885 }..TextLocation { line: 38, column: 18, offset: 886 }) }], err_no: pou__recursive_data_structure } -SemanticError { message: "Recursive data structure `B -> C -> E -> F -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 156 }..TextLocation { line: 7, column: 18, offset: 157 }) }, SourceLocation { span: Range(TextLocation { line: 11, column: 27, offset: 250 }..TextLocation { line: 11, column: 28, offset: 251 }) }, SourceLocation { span: Range(TextLocation { line: 17, column: 17, offset: 378 }..TextLocation { line: 17, column: 18, offset: 379 }) }, SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 484 }..TextLocation { line: 21, column: 28, offset: 485 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `F -> G -> H -> I -> F` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 472 }..TextLocation { line: 21, column: 28, offset: 473 }) }, SourceLocation { span: Range(TextLocation { line: 28, column: 17, offset: 627 }..TextLocation { line: 28, column: 18, offset: 628 }) }, SourceLocation { span: Range(TextLocation { line: 32, column: 27, offset: 721 }..TextLocation { line: 32, column: 28, offset: 722 }) }, SourceLocation { span: Range(TextLocation { line: 38, column: 17, offset: 849 }..TextLocation { line: 38, column: 18, offset: 850 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `B -> C -> E -> F -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 156 }..TextLocation { line: 7, column: 18, offset: 157 }) }, SourceLocation { span: Range(TextLocation { line: 11, column: 27, offset: 250 }..TextLocation { line: 11, column: 28, offset: 251 }) }, SourceLocation { span: Range(TextLocation { line: 17, column: 17, offset: 378 }..TextLocation { line: 17, column: 18, offset: 379 }) }, SourceLocation { span: Range(TextLocation { line: 21, column: 27, offset: 472 }..TextLocation { line: 21, column: 28, offset: 473 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap index 882c6e38e8..2fa7035880 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_bcb.snap @@ -2,5 +2,5 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `B -> C -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 17, offset: 114 }..TextLocation { line: 5, column: 18, offset: 115 }) }, SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 210 }..TextLocation { line: 9, column: 18, offset: 211 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `B -> C -> B` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 17, offset: 102 }..TextLocation { line: 5, column: 18, offset: 103 }) }, SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 186 }..TextLocation { line: 9, column: 18, offset: 187 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap index 192e93569b..108c58431d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__one_cycle_with_multiple_identical_members_aba.snap @@ -2,5 +2,5 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 152 }..TextLocation { line: 7, column: 18, offset: 153 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 7, column: 17, offset: 151 }..TextLocation { line: 7, column: 18, offset: 152 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap index 8bcfd6106f..58ea13a545 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_aa_and_aba.snap @@ -3,5 +3,5 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- SemanticError { message: "Recursive data structure `A -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }], err_no: pou__recursive_data_structure } -SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 6, column: 17, offset: 137 }..TextLocation { line: 6, column: 18, offset: 138 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `A -> B -> A` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 1, column: 17, offset: 18 }..TextLocation { line: 1, column: 18, offset: 19 }) }, SourceLocation { span: Range(TextLocation { line: 6, column: 17, offset: 125 }..TextLocation { line: 6, column: 18, offset: 126 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap index 9e5b7401df..c8a751145d 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__recursive_validation_tests__structs__two_cycles_branch_cc_and_cec.snap @@ -2,6 +2,6 @@ source: src/validation/tests/recursive_validation_tests.rs expression: res --- -SemanticError { message: "Recursive data structure `C -> C` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 210 }..TextLocation { line: 9, column: 18, offset: 211 }) }], err_no: pou__recursive_data_structure } -SemanticError { message: "Recursive data structure `C -> E -> C` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 210 }..TextLocation { line: 9, column: 18, offset: 211 }) }, SourceLocation { span: Range(TextLocation { line: 14, column: 17, offset: 329 }..TextLocation { line: 14, column: 18, offset: 330 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `C -> C` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 186 }..TextLocation { line: 9, column: 18, offset: 187 }) }], err_no: pou__recursive_data_structure } +SemanticError { message: "Recursive data structure `C -> E -> C` has infinite size", range: [SourceLocation { span: Range(TextLocation { line: 9, column: 17, offset: 186 }..TextLocation { line: 9, column: 18, offset: 187 }) }, SourceLocation { span: Range(TextLocation { line: 14, column: 17, offset: 293 }..TextLocation { line: 14, column: 18, offset: 294 }) }], err_no: pou__recursive_data_structure } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_in_intermediate_fb.snap b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_in_intermediate_fb.snap index ce077a908b..157f75e045 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_in_intermediate_fb.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_in_intermediate_fb.snap @@ -2,5 +2,5 @@ source: src/validation/tests/reference_resolve_tests.rs expression: res --- -SyntaxError { message: "Illegal access to private member fb1.f", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 18, offset: 413 }..TextLocation { line: 18, column: 19, offset: 414 }) }], err_no: reference__illegal_access } +SyntaxError { message: "Illegal access to private member fb1.f", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 18, offset: 393 }..TextLocation { line: 18, column: 19, offset: 394 }) }], err_no: reference__illegal_access } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_is_illegal.snap b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_is_illegal.snap index de996a85ec..7fb1b20c72 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_is_illegal.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__reference_to_private_variable_is_illegal.snap @@ -2,5 +2,5 @@ source: src/validation/tests/reference_resolve_tests.rs expression: res --- -SyntaxError { message: "Illegal access to private member prg.s", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 20, offset: 175 }..TextLocation { line: 8, column: 21, offset: 176 }) }], err_no: reference__illegal_access } +SyntaxError { message: "Illegal access to private member prg.s", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 20, offset: 174 }..TextLocation { line: 8, column: 21, offset: 175 }) }], err_no: reference__illegal_access } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resole_struct_member_access.snap b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resole_struct_member_access.snap index d08c1beecd..f3548e849f 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resole_struct_member_access.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resole_struct_member_access.snap @@ -2,10 +2,10 @@ source: src/validation/tests/reference_resolve_tests.rs expression: res --- -SyntaxError { message: "Could not resolve reference to field10", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 18, offset: 694 }..TextLocation { line: 27, column: 25, offset: 701 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to field20", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 18, offset: 721 }..TextLocation { line: 28, column: 25, offset: 728 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to field30", range: [SourceLocation { span: Range(TextLocation { line: 29, column: 18, offset: 748 }..TextLocation { line: 29, column: 25, offset: 755 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to subfield10", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 22, offset: 955 }..TextLocation { line: 37, column: 32, offset: 965 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to subfield20", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 22, offset: 989 }..TextLocation { line: 38, column: 32, offset: 999 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to subfield30", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 22, offset: 1023 }..TextLocation { line: 39, column: 32, offset: 1033 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to field10", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 18, offset: 691 }..TextLocation { line: 27, column: 25, offset: 698 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to field20", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 18, offset: 718 }..TextLocation { line: 28, column: 25, offset: 725 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to field30", range: [SourceLocation { span: Range(TextLocation { line: 29, column: 18, offset: 745 }..TextLocation { line: 29, column: 25, offset: 752 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to subfield10", range: [SourceLocation { span: Range(TextLocation { line: 37, column: 22, offset: 951 }..TextLocation { line: 37, column: 32, offset: 961 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to subfield20", range: [SourceLocation { span: Range(TextLocation { line: 38, column: 22, offset: 985 }..TextLocation { line: 38, column: 32, offset: 995 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to subfield30", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 22, offset: 1019 }..TextLocation { line: 39, column: 32, offset: 1029 }) }], err_no: reference__unresolved } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_block_calls_in_structs_and_field_access.snap b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_block_calls_in_structs_and_field_access.snap index 141aaf0dda..fe9ebe56b9 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_block_calls_in_structs_and_field_access.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_block_calls_in_structs_and_field_access.snap @@ -2,10 +2,10 @@ source: src/validation/tests/reference_resolve_tests.rs expression: res --- -SyntaxError { message: "Could not resolve reference to fb3", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 29, offset: 650 }..TextLocation { line: 24, column: 32, offset: 653 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to a", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 33, offset: 654 }..TextLocation { line: 24, column: 34, offset: 655 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to fb3", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 43, offset: 664 }..TextLocation { line: 24, column: 46, offset: 667 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to b", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 47, offset: 668 }..TextLocation { line: 24, column: 48, offset: 669 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to fb3", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 57, offset: 678 }..TextLocation { line: 24, column: 60, offset: 681 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to c", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 61, offset: 682 }..TextLocation { line: 24, column: 62, offset: 683 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to fb3", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 29, offset: 648 }..TextLocation { line: 24, column: 32, offset: 651 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to a", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 33, offset: 652 }..TextLocation { line: 24, column: 34, offset: 653 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to fb3", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 43, offset: 662 }..TextLocation { line: 24, column: 46, offset: 665 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to b", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 47, offset: 666 }..TextLocation { line: 24, column: 48, offset: 667 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to fb3", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 57, offset: 676 }..TextLocation { line: 24, column: 60, offset: 679 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to c", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 61, offset: 680 }..TextLocation { line: 24, column: 62, offset: 681 }) }], err_no: reference__unresolved } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_members_via_qualifier.snap b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_members_via_qualifier.snap index efe8e6dc98..6d0af40985 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_members_via_qualifier.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__reference_resolve_tests__resolve_function_members_via_qualifier.snap @@ -2,7 +2,7 @@ source: src/validation/tests/reference_resolve_tests.rs expression: res --- -SyntaxError { message: "Could not resolve reference to a", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 20, offset: 181 }..TextLocation { line: 6, column: 21, offset: 182 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to b", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 20, offset: 217 }..TextLocation { line: 7, column: 21, offset: 218 }) }], err_no: reference__unresolved } -SyntaxError { message: "Could not resolve reference to c", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 20, offset: 253 }..TextLocation { line: 8, column: 21, offset: 254 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to a", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 20, offset: 180 }..TextLocation { line: 6, column: 21, offset: 181 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to b", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 20, offset: 216 }..TextLocation { line: 7, column: 21, offset: 217 }) }], err_no: reference__unresolved } +SyntaxError { message: "Could not resolve reference to c", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 20, offset: 252 }..TextLocation { line: 8, column: 21, offset: 253 }) }], err_no: reference__unresolved } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_pointer_to_too_small_type_result_in_an_error.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_pointer_to_too_small_type_result_in_an_error.snap index 3c854c0028..907136b3db 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_pointer_to_too_small_type_result_in_an_error.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_pointer_to_too_small_type_result_in_an_error.snap @@ -2,6 +2,6 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "The type DWORD 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 200 }..TextLocation { line: 8, column: 26, offset: 214 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__FOO_ptr' to 'DWORD'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 200 }..TextLocation { line: 8, column: 26, offset: 214 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DWORD 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 174 }..TextLocation { line: 8, column: 26, offset: 188 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__FOO_ptr' to 'DWORD'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 174 }..TextLocation { line: 8, column: 26, offset: 188 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap index b584c1c2a0..b1a4cec19e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assign_too_small_type_to_pointer_result_in_an_error.snap @@ -2,6 +2,6 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "The type DWORD 32 is too small to to be stored in a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 200 }..TextLocation { line: 8, column: 26, offset: 214 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to '__FOO_ptr'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 200 }..TextLocation { line: 8, column: 26, offset: 214 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DWORD 32 is too small to to be stored in a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 174 }..TextLocation { line: 8, column: 26, offset: 188 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign 'DWORD' to '__FOO_ptr'", range: [SourceLocation { span: Range(TextLocation { line: 8, column: 12, offset: 174 }..TextLocation { line: 8, column: 26, offset: 188 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap index b85714dde6..76ca073189 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assigning_to_rvalue.snap @@ -2,7 +2,7 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Expression is not assignable", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 12, offset: 193 }..TextLocation { line: 11, column: 13, offset: 194 }) }], err_no: reference__expected } -SyntaxError { message: "Expression is not assignable", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 12, offset: 213 }..TextLocation { line: 12, column: 13, offset: 214 }) }], err_no: reference__expected } -SyntaxError { message: "Expression is not assignable", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 17, offset: 238 }..TextLocation { line: 13, column: 18, offset: 239 }) }], err_no: reference__expected } +SyntaxError { message: "Expression is not assignable", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 12, offset: 189 }..TextLocation { line: 11, column: 13, offset: 190 }) }], err_no: reference__expected } +SyntaxError { message: "Expression is not assignable", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 12, offset: 209 }..TextLocation { line: 12, column: 13, offset: 210 }) }], err_no: reference__expected } +SyntaxError { message: "Expression is not assignable", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 17, offset: 234 }..TextLocation { line: 13, column: 18, offset: 235 }) }], err_no: reference__expected } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assignment_to_enum_literals_results_in_error.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assignment_to_enum_literals_results_in_error.snap index 06e1c72dd0..44b88d5242 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assignment_to_enum_literals_results_in_error.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__assignment_to_enum_literals_results_in_error.snap @@ -2,7 +2,7 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Cannot assign to CONSTANT '__prg_state.OPEN'", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 12, offset: 230 }..TextLocation { line: 12, column: 16, offset: 234 }) }], err_no: var__cannot_assign_to_const } -SyntaxError { message: "Cannot assign to CONSTANT '__global_g_enum.B'", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 12, offset: 253 }..TextLocation { line: 13, column: 13, offset: 254 }) }], err_no: var__cannot_assign_to_const } -SyntaxError { message: "Cannot assign to CONSTANT 'Color.red'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 273 }..TextLocation { line: 14, column: 15, offset: 276 }) }], err_no: var__cannot_assign_to_const } +SyntaxError { message: "Cannot assign to CONSTANT '__prg_state.OPEN'", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 12, offset: 228 }..TextLocation { line: 12, column: 16, offset: 232 }) }], err_no: var__cannot_assign_to_const } +SyntaxError { message: "Cannot assign to CONSTANT '__global_g_enum.B'", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 12, offset: 251 }..TextLocation { line: 13, column: 13, offset: 252 }) }], err_no: var__cannot_assign_to_const } +SyntaxError { message: "Cannot assign to CONSTANT 'Color.red'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 271 }..TextLocation { line: 14, column: 15, offset: 274 }) }], err_no: var__cannot_assign_to_const } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__case_condition_used_outside_case_statement.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__case_condition_used_outside_case_statement.snap index 2cd30cd4be..2acaacb3ae 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__case_condition_used_outside_case_statement.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__case_condition_used_outside_case_statement.snap @@ -2,6 +2,6 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Case condition used outside of case statement! Did you mean to use ';'?", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 3, offset: 50 }..TextLocation { line: 5, column: 23, offset: 70 }) }], err_no: case__case_condition_outside_case_statement } -SyntaxError { message: "Case condition used outside of case statement! Did you mean to use ';'?", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 3, offset: 79 }..TextLocation { line: 6, column: 5, offset: 81 }) }], err_no: case__case_condition_outside_case_statement } +SyntaxError { message: "Case condition used outside of case statement! Did you mean to use ';'?", range: [SourceLocation { span: Range(TextLocation { line: 5, column: 12, offset: 86 }..TextLocation { line: 5, column: 32, offset: 106 }) }], err_no: case__case_condition_outside_case_statement } +SyntaxError { message: "Case condition used outside of case statement! Did you mean to use ';'?", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 12, offset: 124 }..TextLocation { line: 6, column: 14, offset: 126 }) }], err_no: case__case_condition_outside_case_statement } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__function_call_parameter_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__function_call_parameter_validation.snap index 85e81ff127..2d8ed5723e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__function_call_parameter_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__function_call_parameter_validation.snap @@ -2,12 +2,12 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 24, offset: 360 }..TextLocation { line: 22, column: 28, offset: 364 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 30, offset: 366 }..TextLocation { line: 22, column: 34, offset: 370 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 7, offset: 425 }..TextLocation { line: 24, column: 21, offset: 439 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 23, offset: 441 }..TextLocation { line: 24, column: 37, offset: 455 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 23, offset: 441 }..TextLocation { line: 24, column: 37, offset: 455 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 7, offset: 605 }..TextLocation { line: 26, column: 11, offset: 609 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 13, offset: 611 }..TextLocation { line: 26, column: 17, offset: 615 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 13, offset: 611 }..TextLocation { line: 26, column: 17, offset: 615 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 33, offset: 507 }..TextLocation { line: 22, column: 37, offset: 511 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 39, offset: 513 }..TextLocation { line: 22, column: 43, offset: 517 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 16, offset: 581 }..TextLocation { line: 24, column: 30, offset: 595 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 32, offset: 597 }..TextLocation { line: 24, column: 46, offset: 611 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 32, offset: 597 }..TextLocation { line: 24, column: 46, offset: 611 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 16, offset: 770 }..TextLocation { line: 26, column: 20, offset: 774 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 22, offset: 776 }..TextLocation { line: 26, column: 26, offset: 780 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 22, offset: 776 }..TextLocation { line: 26, column: 26, offset: 780 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__invalid_char_assignments.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__invalid_char_assignments.snap index abd45b1be1..871ec1d945 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__invalid_char_assignments.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__invalid_char_assignments.snap @@ -2,16 +2,16 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Value: 'AJK%&/231' exceeds length for type: CHAR", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 3, offset: 124 }..TextLocation { line: 10, column: 19, offset: 140 }) }], err_no: syntax__generic_error } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 3, offset: 124 }..TextLocation { line: 10, column: 19, offset: 140 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Value: '898JKAN' exceeds length for type: WCHAR", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 3, offset: 156 }..TextLocation { line: 11, column: 18, offset: 171 }) }], err_no: syntax__generic_error } -SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'WCHAR'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 3, offset: 156 }..TextLocation { line: 11, column: 18, offset: 171 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 3, offset: 188 }..TextLocation { line: 13, column: 10, offset: 195 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'WCHAR'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 3, offset: 211 }..TextLocation { line: 14, column: 10, offset: 218 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 3, offset: 247 }..TextLocation { line: 17, column: 9, offset: 253 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 3, offset: 269 }..TextLocation { line: 18, column: 10, offset: 276 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 3, offset: 308 }..TextLocation { line: 21, column: 9, offset: 314 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'WCHAR'", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 3, offset: 330 }..TextLocation { line: 22, column: 10, offset: 337 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 3, offset: 354 }..TextLocation { line: 24, column: 9, offset: 360 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 3, offset: 376 }..TextLocation { line: 25, column: 9, offset: 382 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Value: 'AJK%&/231' exceeds length for type: CHAR", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 12, offset: 205 }..TextLocation { line: 10, column: 28, offset: 221 }) }], err_no: syntax__generic_error } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 12, offset: 205 }..TextLocation { line: 10, column: 28, offset: 221 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Value: '898JKAN' exceeds length for type: WCHAR", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 12, offset: 246 }..TextLocation { line: 11, column: 27, offset: 261 }) }], err_no: syntax__generic_error } +SyntaxError { message: "Invalid assignment: cannot assign 'WSTRING' to 'WCHAR'", range: [SourceLocation { span: Range(TextLocation { line: 11, column: 12, offset: 246 }..TextLocation { line: 11, column: 27, offset: 261 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'WCHAR' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 12, offset: 287 }..TextLocation { line: 13, column: 19, offset: 294 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'WCHAR'", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 319 }..TextLocation { line: 14, column: 19, offset: 326 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'INT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 12, offset: 373 }..TextLocation { line: 17, column: 18, offset: 379 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'DINT' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 12, offset: 404 }..TextLocation { line: 18, column: 19, offset: 411 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'CHAR'", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 12, offset: 461 }..TextLocation { line: 21, column: 18, offset: 467 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'WCHAR'", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 12, offset: 492 }..TextLocation { line: 22, column: 19, offset: 499 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'INT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 12, offset: 525 }..TextLocation { line: 24, column: 18, offset: 531 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'CHAR' to 'STRING'", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 12, offset: 556 }..TextLocation { line: 25, column: 18, offset: 562 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_call_parameter_validation.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_call_parameter_validation.snap index 405d2c4daf..10d97c65da 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_call_parameter_validation.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_call_parameter_validation.snap @@ -2,12 +2,12 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 25, offset: 354 }..TextLocation { line: 22, column: 29, offset: 358 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 31, offset: 360 }..TextLocation { line: 22, column: 35, offset: 364 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 8, offset: 420 }..TextLocation { line: 24, column: 22, offset: 434 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 24, offset: 436 }..TextLocation { line: 24, column: 38, offset: 450 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 24, offset: 436 }..TextLocation { line: 24, column: 38, offset: 450 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 8, offset: 602 }..TextLocation { line: 26, column: 12, offset: 606 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 14, offset: 608 }..TextLocation { line: 26, column: 18, offset: 612 }) }], err_no: type__incompatible_size } -SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 14, offset: 608 }..TextLocation { line: 26, column: 18, offset: 612 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 34, offset: 501 }..TextLocation { line: 22, column: 38, offset: 505 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Cannot mix implicit and explicit call parameters!", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 40, offset: 507 }..TextLocation { line: 22, column: 44, offset: 511 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 17, offset: 576 }..TextLocation { line: 24, column: 31, offset: 590 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 33, offset: 592 }..TextLocation { line: 24, column: 47, offset: 606 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 33, offset: 592 }..TextLocation { line: 24, column: 47, offset: 606 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign 'STRING' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 17, offset: 767 }..TextLocation { line: 26, column: 21, offset: 771 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "The type DINT 32 is too small to hold a Pointer", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 23, offset: 773 }..TextLocation { line: 26, column: 27, offset: 777 }) }], err_no: type__incompatible_size } +SyntaxError { message: "Invalid assignment: cannot assign '__main_var3' to 'DINT'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 23, offset: 773 }..TextLocation { line: 26, column: 27, offset: 777 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_missing_inout_assignment.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_missing_inout_assignment.snap index daa401b9c8..fb6ad8e4bc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_missing_inout_assignment.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__program_missing_inout_assignment.snap @@ -2,8 +2,8 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 3, offset: 216 }..TextLocation { line: 17, column: 7, offset: 220 }) }], err_no: pou__missing_action_container } -SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 3, offset: 258 }..TextLocation { line: 18, column: 7, offset: 262 }) }], err_no: pou__missing_action_container } -SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 19, column: 3, offset: 279 }..TextLocation { line: 19, column: 7, offset: 283 }) }], err_no: pou__missing_action_container } -SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 20, column: 3, offset: 294 }..TextLocation { line: 20, column: 7, offset: 298 }) }], err_no: pou__missing_action_container } +SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 12, offset: 327 }..TextLocation { line: 17, column: 16, offset: 331 }) }], err_no: pou__missing_action_container } +SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 12, offset: 378 }..TextLocation { line: 18, column: 16, offset: 382 }) }], err_no: pou__missing_action_container } +SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 19, column: 12, offset: 408 }..TextLocation { line: 19, column: 16, offset: 412 }) }], err_no: pou__missing_action_container } +SyntaxError { message: "Missing inout parameter: inout1", range: [SourceLocation { span: Range(TextLocation { line: 20, column: 12, offset: 432 }..TextLocation { line: 20, column: 16, offset: 436 }) }], err_no: pou__missing_action_container } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__ref_builtin_function_reports_invalid_param_count.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__ref_builtin_function_reports_invalid_param_count.snap index f86be4554f..d3c13c2ad3 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__ref_builtin_function_reports_invalid_param_count.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__ref_builtin_function_reports_invalid_param_count.snap @@ -3,5 +3,5 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- SyntaxError { message: "Invalid parameter count. Received 0 parameters while 1 parameters were expected.", range: [SourceLocation { span: Range(TextLocation { line: 6, column: 12, offset: 134 }..TextLocation { line: 6, column: 15, offset: 137 }) }], err_no: call__invalid_parameter_count } -SyntaxError { message: "Invalid parameter count. Received 4 parameters while 1 parameters were expected.", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 12, offset: 154 }..TextLocation { line: 7, column: 15, offset: 157 }) }], err_no: call__invalid_parameter_count } +SyntaxError { message: "Invalid parameter count. Received 4 parameters while 1 parameters were expected.", range: [SourceLocation { span: Range(TextLocation { line: 7, column: 12, offset: 153 }..TextLocation { line: 7, column: 15, offset: 156 }) }], err_no: call__invalid_parameter_count } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap index 44b98b2b1f..a9b6d99a12 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__reference_to_reference_assignments_in_function_arguments.snap @@ -5,7 +5,7 @@ expression: res SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_INT' to '__prog_input1'", range: [SourceLocation { span: Range(TextLocation { line: 46, column: 12, offset: 1286 }..TextLocation { line: 46, column: 34, offset: 1308 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__prog_input2'", range: [SourceLocation { span: Range(TextLocation { line: 47, column: 12, offset: 1322 }..TextLocation { line: 47, column: 34, offset: 1344 }) }], err_no: var__invalid_assignment } SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_STRING' to '__prog_input3'", range: [SourceLocation { span: Range(TextLocation { line: 48, column: 12, offset: 1358 }..TextLocation { line: 48, column: 34, offset: 1380 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_INT' to '__prog_input1'", range: [SourceLocation { span: Range(TextLocation { line: 54, column: 12, offset: 1596 }..TextLocation { line: 54, column: 32, offset: 1616 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__prog_input2'", range: [SourceLocation { span: Range(TextLocation { line: 55, column: 12, offset: 1630 }..TextLocation { line: 55, column: 32, offset: 1650 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO___global_global6' to '__prog_input3'", range: [SourceLocation { span: Range(TextLocation { line: 56, column: 12, offset: 1664 }..TextLocation { line: 56, column: 32, offset: 1684 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_INT' to '__prog_input1'", range: [SourceLocation { span: Range(TextLocation { line: 54, column: 12, offset: 1588 }..TextLocation { line: 54, column: 32, offset: 1608 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO_REAL' to '__prog_input2'", range: [SourceLocation { span: Range(TextLocation { line: 55, column: 12, offset: 1622 }..TextLocation { line: 55, column: 32, offset: 1642 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__POINTER_TO___global_global6' to '__prog_input3'", range: [SourceLocation { span: Range(TextLocation { line: 56, column: 12, offset: 1656 }..TextLocation { line: 56, column: 32, offset: 1676 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer.snap index 644d78ef60..59b954d7c1 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer.snap @@ -2,8 +2,8 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 4, offset: 227 }..TextLocation { line: 15, column: 10, offset: 233 }) }], err_no: case__duplicate_condition } -SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 4, offset: 254 }..TextLocation { line: 17, column: 13, offset: 263 }) }], err_no: case__duplicate_condition } -SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 19, column: 4, offset: 284 }..TextLocation { line: 19, column: 12, offset: 292 }) }], err_no: case__duplicate_condition } -SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 4, offset: 313 }..TextLocation { line: 21, column: 7, offset: 316 }) }], err_no: case__duplicate_condition } +SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 16, offset: 332 }..TextLocation { line: 15, column: 22, offset: 338 }) }], err_no: case__duplicate_condition } +SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 16, offset: 386 }..TextLocation { line: 17, column: 25, offset: 395 }) }], err_no: case__duplicate_condition } +SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 19, column: 16, offset: 443 }..TextLocation { line: 19, column: 24, offset: 451 }) }], err_no: case__duplicate_condition } +SyntaxError { message: "Duplicate condition value: 4. Occurred more than once!", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 16, offset: 499 }..TextLocation { line: 21, column: 19, offset: 502 }) }], err_no: case__duplicate_condition } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap index 31b16ab83c..1ea41bc5ba 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_duplicate_integer_non_const_var_reference.snap @@ -2,8 +2,8 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "'x' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 4, offset: 165 }..TextLocation { line: 13, column: 5, offset: 166 }) }], err_no: type__invalid_type } -SyntaxError { message: "'y' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 4, offset: 216 }..TextLocation { line: 15, column: 5, offset: 217 }) }], err_no: type__invalid_type } -SyntaxError { message: "'x' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 4, offset: 267 }..TextLocation { line: 17, column: 7, offset: 270 }) }], err_no: type__invalid_type } -SyntaxError { message: "'x' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 4, offset: 346 }..TextLocation { line: 21, column: 11, offset: 353 }) }], err_no: type__invalid_type } +SyntaxError { message: "'x' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 13, column: 16, offset: 246 }..TextLocation { line: 13, column: 17, offset: 247 }) }], err_no: type__invalid_type } +SyntaxError { message: "'y' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 16, offset: 324 }..TextLocation { line: 15, column: 17, offset: 325 }) }], err_no: type__invalid_type } +SyntaxError { message: "'x' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 16, offset: 402 }..TextLocation { line: 17, column: 19, offset: 405 }) }], err_no: type__invalid_type } +SyntaxError { message: "'x' is no const reference. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 16, offset: 535 }..TextLocation { line: 21, column: 23, offset: 542 }) }], err_no: type__invalid_type } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_invalid_case_conditions.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_invalid_case_conditions.snap index ec0aa5a609..9d1f809b86 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_invalid_case_conditions.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__switch_case_invalid_case_conditions.snap @@ -2,7 +2,7 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid case condition!", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 4, offset: 120 }..TextLocation { line: 10, column: 10, offset: 126 }) }], err_no: case__case_condition_outside_case_statement } -SyntaxError { message: "Cannot resolve constant: CallStatement {\n operator: ReferenceExpr {\n kind: Member(\n Identifier {\n name: \"foo\",\n },\n ),\n base: None,\n },\n parameters: None,\n}. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 4, offset: 120 }..TextLocation { line: 10, column: 10, offset: 126 }) }], err_no: type__invalid_type } -SyntaxError { message: "Invalid case condition!", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 4, offset: 146 }..TextLocation { line: 12, column: 12, offset: 154 }) }], err_no: case__case_condition_outside_case_statement } +SyntaxError { message: "Invalid case condition!", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 16, offset: 174 }..TextLocation { line: 10, column: 22, offset: 180 }) }], err_no: case__case_condition_outside_case_statement } +SyntaxError { message: "Cannot resolve constant: CallStatement {\n operator: ReferenceExpr {\n kind: Member(\n Identifier {\n name: \"foo\",\n },\n ),\n base: None,\n },\n parameters: None,\n}. Non constant variables are not supported in case conditions", range: [SourceLocation { span: Range(TextLocation { line: 10, column: 16, offset: 174 }..TextLocation { line: 10, column: 22, offset: 180 }) }], err_no: type__invalid_type } +SyntaxError { message: "Invalid case condition!", range: [SourceLocation { span: Range(TextLocation { line: 12, column: 16, offset: 227 }..TextLocation { line: 12, column: 24, offset: 235 }) }], err_no: case__case_condition_outside_case_statement } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_arrays_passed_to_functions.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_arrays_passed_to_functions.snap index b55402c641..741d7bf9af 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_arrays_passed_to_functions.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_arrays_passed_to_functions.snap @@ -2,12 +2,12 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_sint' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 17, offset: 976 }..TextLocation { line: 25, column: 25, offset: 984 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_int' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 17, offset: 1004 }..TextLocation { line: 26, column: 24, offset: 1011 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_lint' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 17, offset: 1059 }..TextLocation { line: 28, column: 25, offset: 1067 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_real' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 29, column: 17, offset: 1087 }..TextLocation { line: 29, column: 25, offset: 1095 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_lreal' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 17, offset: 1115 }..TextLocation { line: 30, column: 26, offset: 1124 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_dint_1_10' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 17, offset: 1317 }..TextLocation { line: 35, column: 30, offset: 1330 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_dint_10_100' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 17, offset: 1350 }..TextLocation { line: 36, column: 32, offset: 1365 }) }], err_no: var__invalid_assignment } -SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_dint_2d' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 17, offset: 1442 }..TextLocation { line: 39, column: 28, offset: 1453 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_sint' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 17, offset: 959 }..TextLocation { line: 25, column: 25, offset: 967 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_int' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 17, offset: 987 }..TextLocation { line: 26, column: 24, offset: 994 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_lint' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 17, offset: 1042 }..TextLocation { line: 28, column: 25, offset: 1050 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_real' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 29, column: 17, offset: 1070 }..TextLocation { line: 29, column: 25, offset: 1078 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_lreal' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 30, column: 17, offset: 1098 }..TextLocation { line: 30, column: 26, offset: 1107 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_dint_1_10' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 35, column: 17, offset: 1300 }..TextLocation { line: 35, column: 30, offset: 1313 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_dint_10_100' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 36, column: 17, offset: 1333 }..TextLocation { line: 36, column: 32, offset: 1348 }) }], err_no: var__invalid_assignment } +SyntaxError { message: "Invalid assignment: cannot assign '__main_arr_dint_2d' to '__func_arr_dint'", range: [SourceLocation { span: Range(TextLocation { line: 39, column: 17, offset: 1425 }..TextLocation { line: 39, column: 28, offset: 1436 }) }], err_no: var__invalid_assignment } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref.snap index 1dfae2c2e8..9cdfa1bffc 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref.snap @@ -2,12 +2,12 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 20, offset: 589 }..TextLocation { line: 22, column: 21, offset: 590 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 23, offset: 592 }..TextLocation { line: 22, column: 24, offset: 593 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 20, offset: 616 }..TextLocation { line: 23, column: 21, offset: 617 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 23, offset: 646 }..TextLocation { line: 24, column: 24, offset: 647 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 20, offset: 706 }..TextLocation { line: 26, column: 21, offset: 707 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 23, offset: 709 }..TextLocation { line: 26, column: 24, offset: 710 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 20, offset: 733 }..TextLocation { line: 27, column: 21, offset: 734 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 23, offset: 763 }..TextLocation { line: 28, column: 24, offset: 764 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 20, offset: 561 }..TextLocation { line: 22, column: 21, offset: 562 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 23, offset: 564 }..TextLocation { line: 22, column: 24, offset: 565 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 20, offset: 588 }..TextLocation { line: 23, column: 21, offset: 589 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 23, offset: 618 }..TextLocation { line: 24, column: 24, offset: 619 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 20, offset: 678 }..TextLocation { line: 26, column: 21, offset: 679 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 23, offset: 681 }..TextLocation { line: 26, column: 24, offset: 682 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 27, column: 20, offset: 705 }..TextLocation { line: 27, column: 21, offset: 706 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 28, column: 23, offset: 735 }..TextLocation { line: 28, column: 24, offset: 736 }) }], err_no: call__invalid_parameter_type } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref_explicit.snap b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref_explicit.snap index 5df24aab81..7c26fd053e 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref_explicit.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__statement_validation_tests__validate_call_by_ref_explicit.snap @@ -2,9 +2,9 @@ source: src/validation/tests/statement_validation_tests.rs expression: res --- -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 48, offset: 601 }..TextLocation { line: 22, column: 49, offset: 602 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 48, offset: 784 }..TextLocation { line: 24, column: 49, offset: 785 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 66, offset: 802 }..TextLocation { line: 24, column: 67, offset: 803 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 48, offset: 855 }..TextLocation { line: 25, column: 49, offset: 856 }) }], err_no: call__invalid_parameter_type } -SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 66, offset: 943 }..TextLocation { line: 26, column: 67, offset: 944 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 48, offset: 589 }..TextLocation { line: 22, column: 49, offset: 590 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 48, offset: 772 }..TextLocation { line: 24, column: 49, offset: 773 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 24, column: 66, offset: 790 }..TextLocation { line: 24, column: 67, offset: 791 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefInOut because their type is InOut", range: [SourceLocation { span: Range(TextLocation { line: 25, column: 48, offset: 842 }..TextLocation { line: 25, column: 49, offset: 843 }) }], err_no: call__invalid_parameter_type } +SyntaxError { message: "Expected a reference for parameter byRefOutput because their type is Output", range: [SourceLocation { span: Range(TextLocation { line: 26, column: 66, offset: 930 }..TextLocation { line: 26, column: 67, offset: 931 }) }], err_no: call__invalid_parameter_type } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap index 9cc4047f8e..9c07df33c6 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_length_array_test__builtins__builtins_called_with_invalid_index.snap @@ -2,10 +2,10 @@ source: src/validation/tests/variable_length_array_test.rs expression: res --- -SyntaxError { message: "Invalid type nature for generic argument. REAL is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 29, offset: 369 }..TextLocation { line: 17, column: 35, offset: 375 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 29, offset: 418 }..TextLocation { line: 18, column: 36, offset: 425 }) }], err_no: type__invalid_nature } -SemanticError { message: "Index out of bounds.", range: [SourceLocation { span: Range(TextLocation { line: 19, column: 12, offset: 451 }..TextLocation { line: 19, column: 23, offset: 462 }) }], err_no: vla__dimension_idx_out_of_bounds } -SyntaxError { message: "Invalid type nature for generic argument. REAL is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 29, offset: 525 }..TextLocation { line: 21, column: 35, offset: 531 }) }], err_no: type__invalid_nature } -SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 29, offset: 574 }..TextLocation { line: 22, column: 36, offset: 581 }) }], err_no: type__invalid_nature } -SemanticError { message: "Index out of bounds.", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 12, offset: 607 }..TextLocation { line: 23, column: 23, offset: 618 }) }], err_no: vla__dimension_idx_out_of_bounds } +SyntaxError { message: "Invalid type nature for generic argument. REAL is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 17, column: 29, offset: 361 }..TextLocation { line: 17, column: 35, offset: 367 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 29, offset: 410 }..TextLocation { line: 18, column: 36, offset: 417 }) }], err_no: type__invalid_nature } +SemanticError { message: "Index out of bounds.", range: [SourceLocation { span: Range(TextLocation { line: 19, column: 12, offset: 443 }..TextLocation { line: 19, column: 23, offset: 454 }) }], err_no: vla__dimension_idx_out_of_bounds } +SyntaxError { message: "Invalid type nature for generic argument. REAL is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 21, column: 29, offset: 517 }..TextLocation { line: 21, column: 35, offset: 523 }) }], err_no: type__invalid_nature } +SyntaxError { message: "Invalid type nature for generic argument. TIME is no Int.", range: [SourceLocation { span: Range(TextLocation { line: 22, column: 29, offset: 566 }..TextLocation { line: 22, column: 36, offset: 573 }) }], err_no: type__invalid_nature } +SemanticError { message: "Index out of bounds.", range: [SourceLocation { span: Range(TextLocation { line: 23, column: 12, offset: 599 }..TextLocation { line: 23, column: 23, offset: 610 }) }], err_no: vla__dimension_idx_out_of_bounds } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__constant_fb_instances_are_illegal.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__constant_fb_instances_are_illegal.snap index 544fe4c38c..711eb41551 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__constant_fb_instances_are_illegal.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__constant_fb_instances_are_illegal.snap @@ -2,6 +2,6 @@ source: src/validation/tests/variable_validation_tests.rs expression: res --- -SyntaxError { message: "Invalid constant y - Functionblock- and Class-instances cannot be delcared constant", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 320 }..TextLocation { line: 14, column: 13, offset: 321 }) }], err_no: var__invalid_constant } -SyntaxError { message: "Invalid constant z - Functionblock- and Class-instances cannot be delcared constant", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 12, offset: 342 }..TextLocation { line: 15, column: 13, offset: 343 }) }], err_no: var__invalid_constant } +SyntaxError { message: "Invalid constant y - Functionblock- and Class-instances cannot be delcared constant", range: [SourceLocation { span: Range(TextLocation { line: 14, column: 12, offset: 319 }..TextLocation { line: 14, column: 13, offset: 320 }) }], err_no: var__invalid_constant } +SyntaxError { message: "Invalid constant z - Functionblock- and Class-instances cannot be delcared constant", range: [SourceLocation { span: Range(TextLocation { line: 15, column: 12, offset: 341 }..TextLocation { line: 15, column: 13, offset: 342 }) }], err_no: var__invalid_constant } diff --git a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap index 3ba3c53a57..7ecc904113 100644 --- a/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap +++ b/src/validation/tests/snapshots/rusty__validation__tests__variable_validation_tests__unresolvable_variables_are_reported.snap @@ -2,7 +2,7 @@ source: src/validation/tests/variable_validation_tests.rs expression: res --- -SyntaxError { message: "Unresolved constant 'cx' variable", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 28, offset: 374 }..TextLocation { line: 18, column: 30, offset: 376 }) }], err_no: var__unresolved_constant } -SyntaxError { message: "Could not resolve reference to a", range: [SourceLocation { span: Range(TextLocation { line: 20, column: 29, offset: 455 }..TextLocation { line: 20, column: 30, offset: 456 }) }], err_no: reference__unresolved } -SyntaxError { message: "Unresolved constant 'cai' variable", range: [SourceLocation { span: Range(TextLocation { line: 20, column: 29, offset: 455 }..TextLocation { line: 20, column: 30, offset: 456 }) }], err_no: var__unresolved_constant } +SyntaxError { message: "Unresolved constant 'cx' variable", range: [SourceLocation { span: Range(TextLocation { line: 18, column: 28, offset: 372 }..TextLocation { line: 18, column: 30, offset: 374 }) }], err_no: var__unresolved_constant } +SyntaxError { message: "Could not resolve reference to a", range: [SourceLocation { span: Range(TextLocation { line: 20, column: 29, offset: 453 }..TextLocation { line: 20, column: 30, offset: 454 }) }], err_no: reference__unresolved } +SyntaxError { message: "Unresolved constant 'cai' variable", range: [SourceLocation { span: Range(TextLocation { line: 20, column: 29, offset: 453 }..TextLocation { line: 20, column: 30, offset: 454 }) }], err_no: var__unresolved_constant } diff --git a/src/validation/tests/statement_validation_tests.rs b/src/validation/tests/statement_validation_tests.rs index 72cda6a263..92c16e3226 100644 --- a/src/validation/tests/statement_validation_tests.rs +++ b/src/validation/tests/statement_validation_tests.rs @@ -15,8 +15,8 @@ fn assign_pointer_to_too_small_type_result_in_an_error() { ptr : REF_TO INT; address : DWORD; END_VAR - - address := 16#DEAD_BEEF; + + address := 16#DEAD_BEEF; address := ptr; //should throw error as address is too small to store full pointer END_PROGRAM ", @@ -37,8 +37,8 @@ fn assign_too_small_type_to_pointer_result_in_an_error() { ptr : REF_TO INT; address : DWORD; END_VAR - - address := 16#DEAD_BEEF; + + address := 16#DEAD_BEEF; ptr := address; //should throw error as address is too small to store full pointer END_PROGRAM ", @@ -59,8 +59,8 @@ fn assign_pointer_to_lword() { ptr : REF_TO INT; address : LWORD; END_VAR - - address := 16#DEAD_BEEF; + + address := 16#DEAD_BEEF; address := ptr; END_PROGRAM ", @@ -113,12 +113,12 @@ fn assignment_to_enum_literals_results_in_error() { " TYPE Color: (red, yellow, green); END_TYPE - VAR_GLOBAL + VAR_GLOBAL g_enum: (A, B, C); END_VAR PROGRAM prg - VAR + VAR state: (OPEN, CLOSED); END_VAR @@ -139,40 +139,40 @@ fn invalid_char_assignments() { // WHEN it is validated let diagnostics = parse_and_validate( r#" - PROGRAM mainProg - VAR - c : CHAR; - c2 : CHAR; - wc : WCHAR; - wc2 : WCHAR; - i : INT; - s : STRING; - END_VAR - c := 'AJK%&/231'; // invalid - wc := "898JKAN"; // invalid - - c := wc; // invalid - wc := c; // invalid - - i := 54; - c := i; // invalid - c := 42; // invalid - - s := 'ABC'; - c := s; // invalid - wc := s; // invalid - - i := c; // invalid - s := c; // invalid - - c := 'A'; - c2 := 'B'; - c := c2; - - wc := "A"; - wc2 := "B"; - wc := wc2; - END_PROGRAM"#, + PROGRAM mainProg + VAR + c : CHAR; + c2 : CHAR; + wc : WCHAR; + wc2 : WCHAR; + i : INT; + s : STRING; + END_VAR + c := 'AJK%&/231'; // invalid + wc := "898JKAN"; // invalid + + c := wc; // invalid + wc := c; // invalid + + i := 54; + c := i; // invalid + c := 42; // invalid + + s := 'ABC'; + c := s; // invalid + wc := s; // invalid + + i := c; // invalid + s := c; // invalid + + c := 'A'; + c2 := 'B'; + c := c2; + + wc := "A"; + wc2 := "B"; + wc := wc2; + END_PROGRAM"#, ); // THEN every assignment should be reported @@ -295,32 +295,32 @@ fn switch_case() { // WHEN it is validated let diagnostics = parse_and_validate( r#" - VAR_GLOBAL CONSTANT - BASE : DINT := 1; - END_VAR + VAR_GLOBAL CONSTANT + BASE : DINT := 1; + END_VAR - TYPE myType: ( MYTYPE_A := BASE+1 ); END_TYPE + TYPE myType: ( MYTYPE_A := BASE+1 ); END_TYPE PROGRAM prog - VAR - input, res : DINT; - END_VAR - - CASE input OF - BASE: - res := 1; - MYTYPE_A: - res := 2; - MYTYPE_A+1: - res := 3; - 4: - res := 4; - 2*2+1: - res := 5; + VAR + input, res : DINT; + END_VAR + + CASE input OF + BASE: + res := 1; + MYTYPE_A: + res := 2; + MYTYPE_A+1: + res := 3; + 4: + res := 4; + 2*2+1: + res := 5; (BASE*5)..(BASE*10): - res := 6; - END_CASE - END_PROGRAM + res := 6; + END_CASE + END_PROGRAM "#, ); @@ -334,30 +334,30 @@ fn switch_case_duplicate_integer_non_const_var_reference() { // WHEN it is validated let diagnostics = parse_and_validate( r#" - VAR_GLOBAL CONSTANT - CONST : DINT := 8; - END_VAR + VAR_GLOBAL CONSTANT + CONST : DINT := 8; + END_VAR PROGRAM prog - VAR - input, res, x, y : DINT; - END_VAR - x := 2; - y := x; - - CASE input OF - x: // x is no constant => error - res := 1; - y: // y is no constant => error - res := 2; - 2+x: // x is no constant => error - res := 3; - CONST: - res := 4; - CONST+x: // x is no constant => error - res := 5; - END_CASE - END_PROGRAM + VAR + input, res, x, y : DINT; + END_VAR + x := 2; + y := x; + + CASE input OF + x: // x is no constant => error + res := 1; + y: // y is no constant => error + res := 2; + 2+x: // x is no constant => error + res := 3; + CONST: + res := 4; + CONST+x: // x is no constant => error + res := 5; + END_CASE + END_PROGRAM "#, ); @@ -371,30 +371,30 @@ fn switch_case_duplicate_integer() { // WHEN it is validated let diagnostics = parse_and_validate( r#" - VAR_GLOBAL CONSTANT - BASE : DINT := 2; - GLOB : DINT := 2; - END_VAR + VAR_GLOBAL CONSTANT + BASE : DINT := 2; + GLOB : DINT := 2; + END_VAR - TYPE myType: ( MYTYPE_A := BASE*2 ); END_TYPE + TYPE myType: ( MYTYPE_A := BASE*2 ); END_TYPE PROGRAM prog - VAR - input, res : DINT; - END_VAR - CASE input OF - 4: - res := 1; - BASE*2: - res := 2; - BASE+GLOB: - res := 3; - MYTYPE_A: - res := 4; - 2+2: - res := 5; - END_CASE - END_PROGRAM + VAR + input, res : DINT; + END_VAR + CASE input OF + 4: + res := 1; + BASE*2: + res := 2; + BASE+GLOB: + res := 3; + MYTYPE_A: + res := 4; + 2+2: + res := 5; + END_CASE + END_PROGRAM "#, ); @@ -408,21 +408,21 @@ fn switch_case_invalid_case_conditions() { // WHEN it is validated let diagnostics = parse_and_validate( r#" - FUNCTION foo : DINT - END_FUNCTION + FUNCTION foo : DINT + END_FUNCTION PROGRAM main - VAR - input, res : DINT; - END_VAR - - CASE input OF - foo(): - res := 1; - res := 2: - res := 2; - END_CASE - END_PROGRAM + VAR + input, res : DINT; + END_VAR + + CASE input OF + foo(): + res := 1; + res := 2: + res := 2; + END_CASE + END_PROGRAM "#, ); @@ -436,14 +436,14 @@ fn case_condition_used_outside_case_statement() { // WHEN it is validated let diagnostics = parse_and_validate( r#" - PROGRAM main - VAR - var1 : TOD; - END_VAR - var1 := TOD#20:15:30:123; - 23: - var1 := TOD#20:15:30; - END_PROGRAM + PROGRAM main + VAR + var1 : TOD; + END_VAR + var1 := TOD#20:15:30:123; + 23: + var1 := TOD#20:15:30; + END_PROGRAM "#, ); @@ -458,9 +458,9 @@ fn subrange_compare_function_causes_no_error() { let diagnostics = parse_and_validate( r#" PROGRAM main - VAR + VAR a, b, c, d, e, f : BOOL; - END_VAR + END_VAR VAR_TEMP x,y : INT(0..500); END_VAR @@ -486,9 +486,9 @@ fn aliased_subrange_compare_function_causes_no_error() { r#" TYPE MyInt: INT(0..500); END_TYPE PROGRAM main - VAR + VAR a, b, c, d, e, f : BOOL; - END_VAR + END_VAR VAR_TEMP x,y : MyInt; END_VAR @@ -514,9 +514,9 @@ fn aliased_int_compare_function_causes_no_error() { r#" TYPE MyInt: INT; END_TYPE PROGRAM main - VAR + VAR a, b, c, d, e, f : BOOL; - END_VAR + END_VAR VAR_TEMP x,y : MyInt; END_VAR @@ -539,28 +539,28 @@ fn program_missing_inout_assignment() { // GIVEN let diagnostics = parse_and_validate( " - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1, var2, var3 : DINT; - END_VAR - prog(input1 := var1, output1 => var2); - prog(var1, var2); - prog(var1); - prog(); - END_PROGRAM - ", + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1, var2, var3 : DINT; + END_VAR + prog(input1 := var1, output1 => var2); + prog(var1, var2); + prog(var1); + prog(); + END_PROGRAM + ", ); // THEN assert_validation_snapshot!(&diagnostics); @@ -572,34 +572,34 @@ fn function_call_parameter_validation() { // WHEN let diagnostics = parse_and_validate( r#" - FUNCTION foo : DINT - VAR_INPUT - input1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - END_FUNCTION - - PROGRAM main - VAR - var1 : DINT; - var2 : STRING; - var3 : REF_TO WSTRING; - var4 : REAL; - END_VAR - foo(input1 := var1, inout1 := var1, output1 => var1); // valid - - foo(output1 => var1, var1, var1); // invalid cannot mix explicit and implicit - - foo(input1 := var2, inout1 := var3, output1 => var4); // invalid types assigned + FUNCTION foo : DINT + VAR_INPUT + input1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + END_FUNCTION + + PROGRAM main + VAR + var1 : DINT; + var2 : STRING; + var3 : REF_TO WSTRING; + var4 : REAL; + END_VAR + foo(input1 := var1, inout1 := var1, output1 => var1); // valid + + foo(output1 => var1, var1, var1); // invalid cannot mix explicit and implicit + + foo(input1 := var2, inout1 := var3, output1 => var4); // invalid types assigned // ^^^^^^^^^^^^^^^ REAL assignment to DINT is valid - foo(var2, var3, var4); // invalid types assigned + foo(var2, var3, var4); // invalid types assigned // ^^^^ REAL assignment to DINT is valid - END_PROGRAM + END_PROGRAM "#, ); @@ -613,34 +613,34 @@ fn program_call_parameter_validation() { // WHEN let diagnostics = parse_and_validate( r#" - PROGRAM prog - VAR_INPUT - input1 : DINT; - END_VAR - VAR_IN_OUT - inout1 : DINT; - END_VAR - VAR_OUTPUT - output1 : DINT; - END_VAR - END_PROGRAM - - PROGRAM main - VAR - var1 : DINT; - var2 : STRING; - var3 : REF_TO WSTRING; - var4 : REAL; - END_VAR - prog(input1 := var1, inout1 := var1, output1 => var1); // valid - - prog(output1 => var1, var1, var1); // invalid cannot mix explicit and implicit - - prog(input1 := var2, inout1 := var3, output1 => var4); // invalid types assigned + PROGRAM prog + VAR_INPUT + input1 : DINT; + END_VAR + VAR_IN_OUT + inout1 : DINT; + END_VAR + VAR_OUTPUT + output1 : DINT; + END_VAR + END_PROGRAM + + PROGRAM main + VAR + var1 : DINT; + var2 : STRING; + var3 : REF_TO WSTRING; + var4 : REAL; + END_VAR + prog(input1 := var1, inout1 := var1, output1 => var1); // valid + + prog(output1 => var1, var1, var1); // invalid cannot mix explicit and implicit + + prog(input1 := var2, inout1 := var3, output1 => var4); // invalid types assigned // ^^^^^^^^^^^^^^^ REAL assignment to DINT is valid - prog(var2, var3, var4); // invalid types assigned + prog(var2, var3, var4); // invalid types assigned // ^^^^ REAL assignment to DINT is valid - END_PROGRAM + END_PROGRAM "#, ); @@ -701,7 +701,7 @@ fn reference_to_reference_assignments_in_function_arguments() { input2 := REF(global5), input3 := REF(global6), ); - + prog( // NONE of these should be valid because &(...) returns type information and we // explicitly check if pointer assignments are of the same type @@ -725,7 +725,7 @@ fn ref_builtin_function_reports_invalid_param_count() { x: ARRAY[0..1] OF INT; END_VAR REF(x); // valid - REF(); + REF(); REF(x, 1, 2, 'abc'); END_FUNCTION ", @@ -779,21 +779,21 @@ fn validate_call_by_ref() { VAR_INPUT byValInput : INT; END_VAR - + VAR_IN_OUT byRefInOut : INT; END_VAR - + VAR_OUTPUT byRefOutput : INT; END_VAR END_FUNCTION - + PROGRAM main VAR x : INT := 1; END_VAR - + // The second and third arguments are expected to be references, as such // any call to `func` where these two arguments are literals will fail func(1, 2, 3); @@ -833,12 +833,12 @@ fn validate_call_by_ref_explicit() { VAR x : INT := 1; END_VAR - + // The second and third arguments are expected to be references, as such // any call to `func` where these two arguments are literals will fail func(byValInput := 1, byRefInOut := 2, byRefOutput => ); func(byValInput := 1, byRefInOut := x, byRefOutput => ); // Valid (Output assignments are optional) - func(byValInput := 1, byRefInOut := 2, byRefOutput => 3); + func(byValInput := 1, byRefInOut := 2, byRefOutput => 3); func(byValInput := 1, byRefInOut := 2, byRefOutput => x); func(byValInput := 1, byRefInOut := x, byRefOutput => 3); func(byValInput := 1, byRefInOut := x, byRefOutput => x); // Valid @@ -919,7 +919,7 @@ fn function_block_implicit_downcast() { ); END_PROGRAM - FUNCTION_BLOCK fb_t + FUNCTION_BLOCK fb_t VAR_INPUT {ref} in_ref_int : INT; in_ref_dword : DWORD; @@ -965,7 +965,7 @@ fn program_implicit_downcast() { ); END_PROGRAM - PROGRAM prog + PROGRAM prog VAR_INPUT {ref} in_ref_int : INT; in_ref_dword : DWORD; @@ -1009,7 +1009,7 @@ fn action_implicit_downcast() { in2 : STRING; END_VAR END_FUNCTION_BLOCK - + ACTIONS fb_t ACTION foo END_ACTION @@ -1051,13 +1051,13 @@ fn method_implicit_downcast() { END_VAR METHOD testMethod - VAR_INPUT - val : INT; + VAR_INPUT + val : INT; arr : ARRAY[1..3] OF SINT; ref : REF_TO ARRAY[1..3] OF DINT; END_VAR END_METHOD - END_CLASS + END_CLASS "#, ); @@ -1084,8 +1084,8 @@ fn validate_array_elements_passed_to_functions_by_ref() { END_VAR func(x, x); // Invalid because we pass a whole array - func(x[0], x[1]); // Valid because we pass a variable by array access - func(byRefInOut := x[0], byRefOutput := x[1]); // Valid because we pass a variable by array access + func(x[0], x[1]); // Valid because we pass a variable by array access + func(byRefInOut := x[0], byRefOutput := x[1]); // Valid because we pass a variable by array access END_PROGRAM ", ); @@ -1112,11 +1112,11 @@ fn validate_arrays_passed_to_functions() { arr_real : ARRAY[0..1] OF REAL; arr_lreal : ARRAY[0..1] OF LREAL; - arr_dint_1_2 : ARRAY[1..2] OF DINT; + arr_dint_1_2 : ARRAY[1..2] OF DINT; arr_dint_3_4 : ARRAY[3..4] OF DINT; arr_dint_1_10 : ARRAY[1..10] OF DINT; arr_dint_10_100 : ARRAY[10..100] OF DINT; - + arr_dint_2d : ARRAY[0..1] OF ARRAY[0..1] OF DINT; END_VAR @@ -1152,7 +1152,7 @@ fn assigning_to_rvalue() { x : INT; END_VAR END_FUNCTION - + PROGRAM main VAR i : INT; @@ -1171,12 +1171,12 @@ fn assigning_to_rvalue() { fn assigning_to_qualified_references_allowed() { let diagnostics = parse_and_validate( r#" - PROGRAM prg + PROGRAM prg VAR_INPUT x : INT; END_VAR END_PROGRAM - + PROGRAM main prg.x := 1; END_PROGRAM @@ -1290,20 +1290,20 @@ fn bit_access_with_incorrect_operator_causes_warning() { Output.var1.%Wn1.%Bn1.%Xn1 := Input.var1; // OK Output.var1.n1 := Input.var1; // bitaccess without %X -> Warning END_PROGRAM - + TYPE STRUCT1 : STRUCT var1 : DWORD; END_STRUCT END_TYPE - + TYPE ENUM1 : ( n1 := 1, n2 := 2 ); END_TYPE - + TYPE STRUCT2 : STRUCT var1 : BOOL; @@ -1327,7 +1327,7 @@ fn invalid_cast_statement_causes_error() { i := INT#i; // ok i := INT#4; // ok END_PROGRAM - + TYPE STRUCT1 : STRUCT var1 : DWORD; diff --git a/src/validation/tests/variable_length_array_test.rs b/src/validation/tests/variable_length_array_test.rs index cd5c413e9d..998555c2de 100644 --- a/src/validation/tests/variable_length_array_test.rs +++ b/src/validation/tests/variable_length_array_test.rs @@ -211,7 +211,7 @@ mod naming { VAR_GLOBAL vla : ARRAY[*, *] OF DINT; END_VAR - + FUNCTION foo : DINT VAR_IN_OUT arr : ARRAY[*, *] OF DINT; @@ -255,7 +255,7 @@ mod builtins { #[test] fn builtins_called_with_invalid_index() { let diagnostics = parse_and_validate( - " + " FUNCTION main : DINT VAR arr : ARRAY[0..1] OF DINT; @@ -291,7 +291,7 @@ mod builtins { #[test] fn builtins_called_with_aliased_type() { let diagnostics = parse_and_validate( - " + " FUNCTION main : DINT VAR arr : ARRAY[0..1] OF DINT; diff --git a/src/validation/tests/variable_validation_tests.rs b/src/validation/tests/variable_validation_tests.rs index 27a3c4af7a..a054c7d922 100644 --- a/src/validation/tests/variable_validation_tests.rs +++ b/src/validation/tests/variable_validation_tests.rs @@ -6,7 +6,7 @@ use insta::assert_snapshot; fn uninitialized_constants_fall_back_to_the_default() { let diagnostics = parse_and_validate( " - VAR_GLOBAL + VAR_GLOBAL gX : INT; gXi : INT := 7; END_VAR @@ -17,7 +17,7 @@ fn uninitialized_constants_fall_back_to_the_default() { END_VAR PROGRAM prg - VAR + VAR x : INT; xi : INT := 7; END_VAR @@ -37,7 +37,7 @@ fn uninitialized_constants_fall_back_to_the_default() { fn unresolvable_variables_are_reported() { let diagnostics = parse_and_validate( " - VAR_GLOBAL + VAR_GLOBAL gX : INT := 7 + cgX; gXi : INT := 7; END_VAR @@ -48,7 +48,7 @@ fn unresolvable_variables_are_reported() { END_VAR PROGRAM prg - VAR + VAR x : INT; xi : INT := 7; END_VAR @@ -130,7 +130,7 @@ fn constant_fb_instances_are_illegal() { testMethod := 1; END_METHOD END_CLASS - + VAR_GLOBAL CONSTANT x : INT := 1; y : MyFb; @@ -287,7 +287,7 @@ mod overflows { " VAR_GLOBAL CONSTANT a : INT := 16384; // OK - b : INT := 16384; // OK + b : INT := 16384; // OK c : INT := a + b; // Will overflow END_VAR ", @@ -302,8 +302,8 @@ mod overflows { " VAR_GLOBAL a : INT := 16384; // OK - b : INT := 16384; // OK - c : INT := a + b; // Will overflow + b : INT := 16384; // OK + c : INT := a + b; // Will overflow END_VAR ", ); diff --git a/src/validation/variable.rs b/src/validation/variable.rs index 75723101a4..63e498ecbe 100644 --- a/src/validation/variable.rs +++ b/src/validation/variable.rs @@ -169,7 +169,7 @@ mod variable_validator_tests { let diagnostics = parse_and_validate_buffered( " TYPE the_struct : STRUCT END_STRUCT END_TYPE - + PROGRAM prg VAR my_struct : STRUCT @@ -186,7 +186,7 @@ mod variable_validator_tests { let diagnostics = parse_and_validate_buffered( " TYPE my_enum : (); END_TYPE - + PROGRAM prg VAR my_enum : (); @@ -203,7 +203,7 @@ mod variable_validator_tests { "VAR_GLOBAL x : (red, yellow, green) := 2; // error END_VAR - + PROGRAM main VAR y : (metallic := 1, matte := 2, neon := 3) := red; // error diff --git a/tests/correctness/arrays.rs b/tests/correctness/arrays.rs index 384929be61..079198f9fb 100644 --- a/tests/correctness/arrays.rs +++ b/tests/correctness/arrays.rs @@ -449,7 +449,7 @@ fn assigning_global_arrays_in_function_by_passing_references() { FUNCTION foo : DINT VAR_INPUT in : ARRAY[0..3] OF INT; - END_VAR + END_VAR VAR_INPUT {ref} in_ref : ARRAY[0..3] OF INT; END_VAR @@ -460,7 +460,7 @@ fn assigning_global_arrays_in_function_by_passing_references() { glob_arr_in_ref := in_ref; glob_arr_inout := inout; END_FUNCTION - + PROGRAM main VAR arr_in : ARRAY[0..3] OF INT; @@ -473,12 +473,12 @@ fn assigning_global_arrays_in_function_by_passing_references() { c : ARRAY[0..3] OF INT := (9, 10, 11, 12); END_VAR foo(a, b, c); - + arr_in := glob_arr_in; arr_in_ref := glob_arr_in_ref; arr_inout := glob_arr_inout; END_PROGRAM - + VAR_GLOBAL glob_arr_in : ARRAY[0..3] OF INT; glob_arr_in_ref : ARRAY[0..3] OF INT; @@ -505,7 +505,7 @@ fn assigning_global_arrays_in_program_by_passing_references() { PROGRAM prog VAR_INPUT in : ARRAY[0..3] OF INT; - END_VAR + END_VAR VAR_INPUT {ref} in_ref : ARRAY[0..3] OF INT; END_VAR @@ -516,7 +516,7 @@ fn assigning_global_arrays_in_program_by_passing_references() { glob_arr_in_ref := in_ref; glob_arr_inout := inout; END_PROGRAM - + PROGRAM main VAR arr_in : ARRAY[0..3] OF INT; @@ -529,12 +529,12 @@ fn assigning_global_arrays_in_program_by_passing_references() { c : ARRAY[0..3] OF INT := (9, 10, 11, 12); END_VAR prog(a, b, c); - + arr_in := glob_arr_in; arr_in_ref := glob_arr_in_ref; arr_inout := glob_arr_inout; END_PROGRAM - + VAR_GLOBAL glob_arr_in : ARRAY[0..3] OF INT; glob_arr_in_ref : ARRAY[0..3] OF INT; @@ -567,30 +567,30 @@ fn access_arrays_by_ref() { VAR_IN_OUT inout : ARRAY[0..1] OF INT; END_VAR - glob_a0 := in_ref[0]; - glob_a1 := in_ref[1]; - glob_b0 := inout[0]; - glob_b1 := inout[1]; + glob_a0 := in_ref[0]; + glob_a1 := in_ref[1]; + glob_b0 := inout[0]; + glob_b1 := inout[1]; END_FUNCTION - + PROGRAM main VAR - a0, a1, b0, b1 : INT; + a0, a1, b0, b1 : INT; END_VAR VAR_TEMP a : ARRAY[0..1] OF INT := (1, 2); b : ARRAY[0..1] OF INT := (5, 6); END_VAR foo(a, b); - - a0 := glob_a0; - a1 := glob_a1; - b0 := glob_b0; - b1 := glob_b1; + + a0 := glob_a0; + a1 := glob_a1; + b0 := glob_b0; + b1 := glob_b1; END_PROGRAM - + VAR_GLOBAL - glob_a0, glob_a1, glob_b0, glob_b1 : INT; + glob_a0, glob_a1, glob_b0, glob_b1 : INT; END_VAR "#; @@ -655,24 +655,24 @@ fn struct_initialization_with_array_initializer_using_multiplied_statement() { } let source = " - TYPE myStruct : STRUCT - arr : ARRAY[0..63] OF INT; - idx : INT; - END_STRUCT END_TYPE + TYPE myStruct : STRUCT + arr : ARRAY[0..63] OF INT; + idx : INT; + END_STRUCT END_TYPE PROGRAM target - VAR - val : myStruct := (arr := [64(111)], idx := 222); + VAR + val : myStruct := (arr := [64(111)], idx := 222); END_VAR END_PROGRAM - PROGRAM main + PROGRAM main VAR arr : ARRAY[0..63] OF INT; idx : INT := 0; - END_VAR + END_VAR arr := target.val.arr; idx := target.val.idx; - END_PROGRAM - " + END_PROGRAM + " .to_string(); let mut maintype = MainType { arr: [0; 64], idx: 0 }; diff --git a/tests/correctness/bitaccess.rs b/tests/correctness/bitaccess.rs index 427edc91c8..25bb6c581f 100644 --- a/tests/correctness/bitaccess.rs +++ b/tests/correctness/bitaccess.rs @@ -19,7 +19,7 @@ struct MainType { #[test] fn bitaccess_assignment() { let prog = " - PROGRAM main + PROGRAM main VAR a : BYTE := 2#0000_0101; b : WORD := 0; @@ -98,9 +98,9 @@ fn qualified_reference_assignment() { #[test] fn bitaccess_test() { let prog = " - PROGRAM main - VAR - variable : LWORD; + PROGRAM main + VAR + variable : LWORD; access_var : INT; bitTarget : BOOL; bitTarget2 : BOOL; @@ -138,8 +138,8 @@ fn bitaccess_test() { fn bitaccess_with_var_test() { let prog = " PROGRAM main - VAR - variable : LWORD; + VAR + variable : LWORD; access_var : INT; bitTarget : BOOL; bitTarget2 : BOOL; diff --git a/tests/correctness/classes.rs b/tests/correctness/classes.rs index 00df945960..3b92ab3573 100644 --- a/tests/correctness/classes.rs +++ b/tests/correctness/classes.rs @@ -22,11 +22,11 @@ fn class_reference_in_pou() { VAR x, y : INT; END_VAR - + METHOD testMethod : INT VAR_INPUT myMethodArg : INT; END_VAR VAR myMethodLocalVar : INT; END_VAR - + x := myMethodArg; y := x + 1; myMethodLocalVar := y + 1; @@ -34,7 +34,7 @@ fn class_reference_in_pou() { END_METHOD END_CLASS - PROGRAM main + PROGRAM main VAR cl : MyClass; x : INT := 0; diff --git a/tests/correctness/constants.rs b/tests/correctness/constants.rs index 2d6945ac9f..6ae49174d9 100644 --- a/tests/correctness/constants.rs +++ b/tests/correctness/constants.rs @@ -200,15 +200,15 @@ fn constant_expressions_used_in_array_declaration() { #[test] fn global_constant_string_assignment() { let src = r#" - VAR_GLOBAL CONSTANT - const_string : STRING := 'hello'; - END_VAR + VAR_GLOBAL CONSTANT + const_string : STRING := 'hello'; + END_VAR PROGRAM main - VAR - str : STRING[5]; - END_VAR - str := const_string; + VAR + str : STRING[5]; + END_VAR + str := const_string; END_PROGRAM "#; @@ -226,15 +226,15 @@ fn global_constant_string_assignment() { #[test] fn global_constant_array_assignment() { let src = r#" - VAR_GLOBAL CONSTANT - const_arr : ARRAY[0..3] OF INT := (1,2,3,4); - END_VAR + VAR_GLOBAL CONSTANT + const_arr : ARRAY[0..3] OF INT := (1,2,3,4); + END_VAR PROGRAM main - VAR - arr : ARRAY[0..3] OF INT; - END_VAR - arr := const_arr; + VAR + arr : ARRAY[0..3] OF INT; + END_VAR + arr := const_arr; END_PROGRAM "#; @@ -252,26 +252,26 @@ fn global_constant_array_assignment() { #[test] fn global_constant_struct_assignment() { let src = r#" - TYPE Point : - STRUCT - x,y : INT; - END_STRUCT - END_TYPE - - VAR_GLOBAL CONSTANT - const_strct : Point := (x := 1, y := 2); - END_VAR + TYPE Point : + STRUCT + x,y : INT; + END_STRUCT + END_TYPE + + VAR_GLOBAL CONSTANT + const_strct : Point := (x := 1, y := 2); + END_VAR PROGRAM main - VAR_TEMP - strct : Point; - END_VAR - VAR - x,y : INT; - END_VAR - strct := const_strct; - x := strct.x; - y := strct.y; + VAR_TEMP + strct : Point; + END_VAR + VAR + x,y : INT; + END_VAR + strct := const_strct; + x := strct.x; + y := strct.y; END_PROGRAM "#; diff --git a/tests/correctness/control_flow.rs b/tests/correctness/control_flow.rs index 35ceeb23b9..971d830172 100644 --- a/tests/correctness/control_flow.rs +++ b/tests/correctness/control_flow.rs @@ -120,7 +120,7 @@ fn for_continue_test() { FOR main := 1 TO 10 BY 1 DO main := 10; CONTINUE; - main := 200; + main := 200; END_FOR END_FUNCTION "#; @@ -164,7 +164,7 @@ fn for_loop_exit_test() { FUNCTION main : DINT FOR main := 100 TO 1000 BY 7 DO EXIT; - main := 200; + main := 200; END_FOR "#; @@ -206,7 +206,7 @@ fn loop_exit_test() { FUNCTION main : DINT FOR main := 100 TO 1000 BY 7 DO EXIT; - main := 200; + main := 200; END_FOR WHILE main > 50 DO EXIT; @@ -284,7 +284,7 @@ fn for_loop_and_increment_10_times_change_vars() { i, : INT := 0; END_VAR VAR_TEMP - start, end : INT; + start, end : INT; END_VAR main := 100; start := 1; @@ -310,7 +310,7 @@ fn for_loop_overflow() { } let function = r#" - PROGRAM main + PROGRAM main VAR i : INT; ret : DINT; @@ -537,7 +537,7 @@ fn exit_in_for_loop_in_while_loop() { main := main+1; FOR i := 0 TO 10 BY 1 DO EXIT; - END_FOR + END_FOR END_WHILE main := i + main; END_FUNCTION @@ -560,7 +560,7 @@ fn continue_in_for_loop_in_while_loop() { FOR i := 0 TO 10 BY 1 DO CONTINUE; main := 200; - END_FOR + END_FOR END_WHILE main := i + main; END_FUNCTION @@ -582,7 +582,7 @@ fn repeat_loop_no_entry() { REPEAT i := i+1; main := main + 10; - UNTIL i > 0 + UNTIL i > 0 END_REPEAT main := main + (i * 1000); END_FUNCTION @@ -675,7 +675,7 @@ fn case_statement() { ret : INT; END_VAR ret := 1; - + CASE i OF 1,2,3,4,5,6,7,8,9: ret := 101; 10,11,12..19: ret := 201; diff --git a/tests/correctness/custom_datatypes.rs b/tests/correctness/custom_datatypes.rs index 7dc43dbf8e..d16d5d9a31 100644 --- a/tests/correctness/custom_datatypes.rs +++ b/tests/correctness/custom_datatypes.rs @@ -75,8 +75,8 @@ fn using_nested_structs() { }; let testcode = r#" - TYPE MyInnerStruct: - STRUCT + TYPE MyInnerStruct: + STRUCT innerField1 : BYTE; innerField2 : INT; innerField3 : DINT; @@ -99,7 +99,7 @@ fn using_nested_structs() { myS.str1.innerField1 := 11; myS.str1.innerField2 := 12; myS.str1.innerField3 := 13; - + myS.str2.innerField1 := 21; myS.str2.innerField2 := 22; myS.str2.innerField3 := 23; @@ -142,14 +142,14 @@ fn using_enums() { PROGRAM main VAR - tf1 : TrafficLight; - tf2 : TrafficLight; - tf3 : TrafficLight; + tf1 : TrafficLight; + tf2 : TrafficLight; + tf3 : TrafficLight; END_VAR tf1 := Red; tf2 := Yellow; tf3 := Green; - + END_PROGRAM "#; @@ -176,14 +176,14 @@ fn using_inline_enums() { PROGRAM main VAR - tf1 : (White1, Red1, Yellow1, Green1); - tf2 : (White2, Red2, Yellow2, Green2); - tf3 : (White3, Red3, Yellow3, Green3); + tf1 : (White1, Red1, Yellow1, Green1); + tf2 : (White2, Red2, Yellow2, Green2); + tf3 : (White3, Red3, Yellow3, Green3); END_VAR tf1 := Red1; tf2 := Yellow2; tf3 := Green3; - + END_PROGRAM "#; @@ -209,16 +209,16 @@ fn using_duplicate_enums_with_casts() { TYPE MyEnum2: UINT(red := 10, yellow := 11, green := 12); END_TYPE - + TYPE MyEnum3: DINT(red := 22, yellow := 33, green := 44); END_TYPE PROGRAM main VAR - tf1 : MyEnum; - tf2 : MyEnum2; - tf3 : MyEnum3; + tf1 : MyEnum; + tf2 : MyEnum2; + tf3 : MyEnum3; END_VAR tf1 := MyEnum#red; tf2 := MyEnum2#yellow; @@ -244,7 +244,7 @@ fn using_inline_enums_in_structs() { TYPE TrafficLight: (White, Red, Yellow, Green); END_TYPE - + TYPE MyStruct: STRUCT tf1 : TrafficLight; @@ -280,7 +280,7 @@ fn using_inline_arrays_in_structs() { let mut data = MyStruct { arr1: [0; 4], arr2: [0; 8], arr3: [0; 3] }; let testcode = r#" - + TYPE MyStruct: STRUCT arr1 : ARRAY[0..3] OF INT; diff --git a/tests/correctness/datatypes.rs b/tests/correctness/datatypes.rs index 4d1a706764..2f349b3dc7 100644 --- a/tests/correctness/datatypes.rs +++ b/tests/correctness/datatypes.rs @@ -524,7 +524,7 @@ fn unsinged_byte_expansion3() { arg3 : ULINT; result : ULINT; END_VAR - + result := arg1 + (arg2 + arg3) + (arg2 + arg3); END_PROGRAM "#; @@ -559,12 +559,12 @@ fn assign_short_string_to_long_string_variable() { text : STRING; text2 : STRING; END_VAR - + text := 'abc'; text2 := 'abcdefg'; text2 := 'xyz'; - + END_PROGRAM "#; @@ -606,12 +606,12 @@ fn assign_string_to_string() { text : STRING; text2 : STRING; END_VAR - + text := 'abc'; text2 := text; text := 'def'; - + END_PROGRAM "#; @@ -906,7 +906,7 @@ fn function_return_string_by_ref_via_inout() { VAR_IN_OUT ret: STRING; END_VAR - + ret := 'abc'; END_FUNCTION diff --git a/tests/correctness/expressions.rs b/tests/correctness/expressions.rs index 8df580b6d5..ebd02c985d 100644 --- a/tests/correctness/expressions.rs +++ b/tests/correctness/expressions.rs @@ -47,7 +47,7 @@ fn equal_comparison_with_arbitrary_datatypes() { STRING_EQUAL := TRUE; END_FUNCTION - PROGRAM main + PROGRAM main VAR result1 : DINT; result2 : DINT; @@ -193,7 +193,7 @@ fn enums_can_be_compared() { let function = " TYPE MyEnum : BYTE (zero, aa, bb := 7, cc); END_TYPE - PROGRAM main + PROGRAM main VAR a,b,c : BOOL; END_VAR VAR_TEMP @@ -209,11 +209,11 @@ fn enums_can_be_compared() { IF y = 7 THEN b := TRUE; END_IF - + IF z = 8 THEN c := TRUE; END_IF - END_PROGRAM + END_PROGRAM "; let _: i32 = compile_and_run(function, &mut main); assert_eq!([true, true, true], [main.a, main.b, main.c]); @@ -239,7 +239,7 @@ fn amp_as_and_correctness_test() { a := TRUE; b := TRUE; c := FALSE; - + IF a & b THEN d := TRUE; END_IF @@ -272,9 +272,9 @@ fn aliased_ranged_numbers_can_be_compared() { let src = r#" TYPE MyInt: INT(0..500); END_TYPE PROGRAM main - VAR + VAR a, b, c, d, e, f : BOOL; - END_VAR + END_VAR VAR_TEMP x,y : MyInt; END_VAR diff --git a/tests/correctness/functions.rs b/tests/correctness/functions.rs index 5139d63591..9fb9cc106d 100644 --- a/tests/correctness/functions.rs +++ b/tests/correctness/functions.rs @@ -15,15 +15,15 @@ fn max_function() { let function = r#" - FUNCTION MAX : INT - VAR_INPUT + FUNCTION MAX : INT + VAR_INPUT a : INT; b : INT; END_VAR IF a > b THEN MAX := a; - ELSE + ELSE MAX := b; END_IF END_FUNCTION @@ -99,8 +99,8 @@ fn test_or_sideeffects() { res_or : INT; END_VAR - FUNCTION OR_BRANCH : BOOL - VAR_INPUT + FUNCTION OR_BRANCH : BOOL + VAR_INPUT a : BOOL; b : INT; END_VAR @@ -144,8 +144,8 @@ fn test_and_sideeffects() { res_and : INT; END_VAR - FUNCTION AND_BRANCH : BOOL - VAR_INPUT + FUNCTION AND_BRANCH : BOOL + VAR_INPUT a : BOOL; b : INT; END_VAR @@ -189,8 +189,8 @@ fn test_amp_as_and_sideeffects() { res_and : INT; END_VAR - FUNCTION AND_BRANCH : BOOL - VAR_INPUT + FUNCTION AND_BRANCH : BOOL + VAR_INPUT a : BOOL; b : INT; END_VAR @@ -242,10 +242,10 @@ fn function_block_instances_save_state_per_instance() { END_FUNCTION_BLOCK PROGRAM main - VAR + VAR f : foo; j : foo; - END_VAR + END_VAR f(); f(); j(4); @@ -344,9 +344,9 @@ fn functions_can_be_called_out_of_order() { END_FUNCTION PROGRAM main - VAR + VAR r : INT; - END_VAR + END_VAR r:= foo(); END_PROGRAM "#; @@ -377,7 +377,7 @@ fn function_block_instances_save_state_per_instance_2() { j: FooType, } let function = r#" - FUNCTION_BLOCK Baz + FUNCTION_BLOCK Baz VAR_INPUT i : INT; END_VAR @@ -387,16 +387,16 @@ fn function_block_instances_save_state_per_instance_2() { FUNCTION_BLOCK foo VAR_INPUT i : INT; - baz: Baz; + baz: Baz; END_VAR - + END_FUNCTION_BLOCK PROGRAM main - VAR + VAR f : foo; j : foo; - END_VAR + END_VAR f.baz.i := f.baz.i + 1; f.baz.i := f.baz.i + 1; @@ -434,7 +434,7 @@ fn function_call_inout_variable() { param := param * factor; END_PROGRAM - PROGRAM foo + PROGRAM foo VAR_IN_OUT inout : DINT; END_VAR @@ -466,7 +466,7 @@ fn inouts_behave_like_pointers() { p3: i32, } let function = r#" - VAR_GLOBAL + VAR_GLOBAL snap1 : DINT; snap2 : DINT; snap3 : DINT; @@ -514,23 +514,23 @@ fn var_output_assignment() { } let function = r#" - PROGRAM foo + PROGRAM foo VAR_INPUT input1 : DINT; input2 : DINT; END_VAR VAR_OUTPUT - output1 : DINT; - output2 : DINT; + output1 : DINT; + output2 : DINT; END_VAR - output1 := input1; - output2 := input2; + output1 := input1; + output2 := input2; END_PROGRAM PROGRAM main VAR var1 : DINT; - var2 : DINT; + var2 : DINT; END_VAR foo(7, 8, output1 => var1, output2 => var2); END_PROGRAM @@ -581,23 +581,23 @@ fn var_output_assignment_in_functions() { } let function = r#" - FUNCTION foo : INT + FUNCTION foo : INT VAR_INPUT input1 : DINT; input2 : DINT; END_VAR VAR_OUTPUT - output1 : DINT; - output2 : DINT; + output1 : DINT; + output2 : DINT; END_VAR - output1 := input1 + 2; - output2 := input2 + 3; + output1 := input1 + 2; + output2 := input2 + 3; END_PROGRAM PROGRAM main VAR var1 : DINT; - var2 : DINT; + var2 : DINT; END_VAR foo(7, 8, output1 => var1, output2 => var2); END_PROGRAM @@ -617,19 +617,19 @@ fn optional_output_assignment_in_functions() { } let function = r#" - FUNCTION foo : INT + FUNCTION foo : INT VAR_OUTPUT - output1 : DINT; - output2 : DINT; + output1 : DINT; + output2 : DINT; END_VAR - output1 := 1; - output2 := 2; + output1 := 1; + output2 := 2; END_FUNCTION PROGRAM main VAR var1 : DINT; - var2 : DINT; + var2 : DINT; END_VAR foo(output1 =>, output2 => var2); END_PROGRAM @@ -665,22 +665,22 @@ fn direct_call_on_function_block_array_access() { i : INT; END_VAR VAR - x : INT; - END_VAR - x := i; + x : INT; + END_VAR + x := i; END_FUNCTION_BLOCK PROGRAM main - VAR + VAR f : ARRAY[1..2] OF foo; - x : INT; - y : INT; + x : INT; + y : INT; END_VAR - f[1](i := 10); - x := f[1].x; + f[1](i := 10); + x := f[1].x; - f[2](i := 20); - y := f[2].x; + f[2](i := 20); + y := f[2].x; END_PROGRAM "#; @@ -699,16 +699,16 @@ fn nested_calls_in_call_statement() { } let function = r#" - FUNCTION seven : DINT - seven := 7; + FUNCTION seven : DINT + seven := 7; END_FUNCTION - FUNCTION eight : DINT - eight := 8; + FUNCTION eight : DINT + eight := 8; END_FUNCTION - FUNCTION nine : DINT - nine := 9; + FUNCTION nine : DINT + nine := 9; END_FUNCTION FUNCTION sum : DINT @@ -719,7 +719,7 @@ fn nested_calls_in_call_statement() { PROGRAM main VAR var1 : DINT; - var2 : DINT; + var2 : DINT; END_VAR var1 := sum(seven(), eight(), nine()); @@ -745,14 +745,14 @@ fn nested_calls_passing_aggregate_types() { let function = r#" TYPE Arr : ARRAY[0..1] OF DINT := [1, 1]; END_TYPE - FUNCTION getArr : Arr - getArr[0] := 3; - getArr[1] := 4; + FUNCTION getArr : Arr + getArr[0] := 3; + getArr[1] := 4; END_FUNCTION FUNCTION inc : Arr - VAR_INPUT - a: Arr; + VAR_INPUT + a: Arr; index: DINT; END_VAR @@ -806,7 +806,7 @@ fn mux_test() { num,b : DINT := 2; END_VAR b := num; - main := MUX(num,b,5,6,7,8); //Result is 6 + main := MUX(num,b,5,6,7,8); //Result is 6 END_FUNCTION "#; @@ -848,19 +848,19 @@ fn mux_array_ref() { } let function = r#" - PROGRAM main - VAR - arr1 : ARRAY[0..2] OF DINT; - END_VAR - VAR_TEMP - arr2 : ARRAY[0..2] OF DINT := (0, 1, 2); - arr3 : ARRAY[0..2] OF DINT := (3, 4, 5); - arr4 : ARRAY[0..2] OF DINT := (6, 7, 8); - arr5 : ARRAY[0..2] OF DINT := (9, 9, 9); - END_VAR - arr1 := MUX(2, arr2, arr3, arr4, arr5); // arr4 - END_PROGRAM - "#; + PROGRAM main + VAR + arr1 : ARRAY[0..2] OF DINT; + END_VAR + VAR_TEMP + arr2 : ARRAY[0..2] OF DINT := (0, 1, 2); + arr3 : ARRAY[0..2] OF DINT := (3, 4, 5); + arr4 : ARRAY[0..2] OF DINT := (6, 7, 8); + arr5 : ARRAY[0..2] OF DINT := (9, 9, 9); + END_VAR + arr1 := MUX(2, arr2, arr3, arr4, arr5); // arr4 + END_PROGRAM + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -883,25 +883,25 @@ fn mux_struct_ref() { } let function = r#" - PROGRAM main - VAR - struct1 : myStruct; - END_VAR - VAR_TEMP - struct2 : myStruct := (a := FALSE, b := FALSE); - struct3 : myStruct := (a := FALSE, b := TRUE); - struct4 : myStruct := (a := TRUE, b := FALSE); - struct5 : myStruct := (a := TRUE, b := TRUE); - END_VAR - struct1 := MUX(2, struct2, struct3, struct4, struct5); // struct4 - END_PROGRAM - - TYPE myStruct : STRUCT - a : BOOL; - b : BOOL; - END_STRUCT - END_TYPE - "#; + PROGRAM main + VAR + struct1 : myStruct; + END_VAR + VAR_TEMP + struct2 : myStruct := (a := FALSE, b := FALSE); + struct3 : myStruct := (a := FALSE, b := TRUE); + struct4 : myStruct := (a := TRUE, b := FALSE); + struct5 : myStruct := (a := TRUE, b := TRUE); + END_VAR + struct1 := MUX(2, struct2, struct3, struct4, struct5); // struct4 + END_PROGRAM + + TYPE myStruct : STRUCT + a : BOOL; + b : BOOL; + END_STRUCT + END_TYPE + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -917,20 +917,20 @@ fn mux_string_ref() { } let function = r#" - PROGRAM main - VAR - str1 : STRING; - END_VAR - VAR_TEMP - str2 : STRING := 'str2 '; - str3 : STRING := 'str3 '; - str4 : STRING := 'str4 '; - str5 : STRING := 'str5 '; - str6 : STRING := 'str6 '; - END_VAR - str1 := MUX(3, str2, str3, str4, str5, str6); // str5 - END_PROGRAM - "#; + PROGRAM main + VAR + str1 : STRING; + END_VAR + VAR_TEMP + str2 : STRING := 'str2 '; + str3 : STRING := 'str3 '; + str4 : STRING := 'str4 '; + str5 : STRING := 'str5 '; + str6 : STRING := 'str6 '; + END_VAR + str1 := MUX(3, str2, str3, str4, str5, str6); // str5 + END_PROGRAM + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -946,13 +946,13 @@ fn mux_string_literal() { } let function = r#" - PROGRAM main - VAR - str1 : STRING; - END_VAR - str1 := MUX(3, 'hello', 'world', 'foo', 'baz'); // baz - END_PROGRAM - "#; + PROGRAM main + VAR + str1 : STRING; + END_VAR + str1 := MUX(3, 'hello', 'world', 'foo', 'baz'); // baz + END_PROGRAM + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -977,7 +977,7 @@ fn sel_test_false() { fn sel_test_true() { let function = r#" FUNCTION main : DINT - main := SEL(TRUE,4,5); //Result is 5 + main := SEL(TRUE,4,5); //Result is 5 END_FUNCTION "#; @@ -994,7 +994,7 @@ fn sel_test_true_vars() { VAR a,b : DINT; END_VAR a := 4; b := 5; - main := SEL(TRUE,a,b); //Result is 5 + main := SEL(TRUE,a,b); //Result is 5 END_FUNCTION "#; @@ -1037,23 +1037,23 @@ fn sel_struct_ref() { } let function = r#" - PROGRAM main - VAR - struct1 : myStruct; - END_VAR - VAR_TEMP - struct2 : myStruct := (a := TRUE, b := FALSE); - struct3 : myStruct := (a := FALSE, b := TRUE); - END_VAR - struct1 := SEL(TRUE, struct2, struct3); // struct3 - END_PROGRAM - - TYPE myStruct : STRUCT - a : BOOL; - b : BOOL; - END_STRUCT - END_TYPE - "#; + PROGRAM main + VAR + struct1 : myStruct; + END_VAR + VAR_TEMP + struct2 : myStruct := (a := TRUE, b := FALSE); + struct3 : myStruct := (a := FALSE, b := TRUE); + END_VAR + struct1 := SEL(TRUE, struct2, struct3); // struct3 + END_PROGRAM + + TYPE myStruct : STRUCT + a : BOOL; + b : BOOL; + END_STRUCT + END_TYPE + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -1070,17 +1070,17 @@ fn sel_array_ref() { } let function = r#" - PROGRAM main - VAR - arr1 : ARRAY[0..2] OF DINT; - END_VAR - VAR_TEMP - arr2 : ARRAY[0..2] OF DINT := (0, 1, 2); - arr3 : ARRAY[0..2] OF DINT := (3, 4, 5); - END_VAR - arr1 := SEL(TRUE, arr2, arr3); // arr3 - END_PROGRAM - "#; + PROGRAM main + VAR + arr1 : ARRAY[0..2] OF DINT; + END_VAR + VAR_TEMP + arr2 : ARRAY[0..2] OF DINT := (0, 1, 2); + arr3 : ARRAY[0..2] OF DINT := (3, 4, 5); + END_VAR + arr1 := SEL(TRUE, arr2, arr3); // arr3 + END_PROGRAM + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -1096,17 +1096,17 @@ fn sel_string_ref() { } let function = r#" - PROGRAM main - VAR - str1 : STRING; - END_VAR - VAR_TEMP - str2 : STRING := 'hello'; - str3 : STRING := 'world'; - END_VAR - str1 := SEL(TRUE, str2, str3); // str3 - END_PROGRAM - "#; + PROGRAM main + VAR + str1 : STRING; + END_VAR + VAR_TEMP + str2 : STRING := 'hello'; + str3 : STRING := 'world'; + END_VAR + str1 := SEL(TRUE, str2, str3); // str3 + END_PROGRAM + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -1122,13 +1122,13 @@ fn sel_string_literal() { } let function = r#" - PROGRAM main - VAR - str1 : STRING; - END_VAR - str1 := SEL(TRUE, 'hello', 'world'); // world - END_PROGRAM - "#; + PROGRAM main + VAR + str1 : STRING; + END_VAR + str1 := SEL(TRUE, 'hello', 'world'); // world + END_PROGRAM + "#; let mut main = MainType::default(); let _: i32 = compile_and_run(function.to_string(), &mut main); @@ -1174,13 +1174,13 @@ fn sizeof_test() { TYPE MyStruct : STRUCT a : BYTE; //8bit - offset 0 -> 1 byte b : DWORD; //32bit - offset 32 -> 8 bytes - c : WORD; //16bit - offset 64 -> 10 bytes + c : WORD; //16bit - offset 64 -> 10 bytes d : LWORD; //64bit - offset 128 -> 24 bytes END_STRUCT END_TYPE PROGRAM main - VAR - s1 : SINT; + VAR + s1 : SINT; s2 : INT; s3 : DINT; s4 : LINT; diff --git a/tests/correctness/generic_functions.rs b/tests/correctness/generic_functions.rs index b330be9d47..0bd73bedb9 100644 --- a/tests/correctness/generic_functions.rs +++ b/tests/correctness/generic_functions.rs @@ -77,7 +77,7 @@ fn test_generic_function_implemented_in_st_called() { times_two__REAL := val * 2.0; END_FUNCTION - PROGRAM main + PROGRAM main VAR a : INT; b : REAL; @@ -143,7 +143,7 @@ fn test_generic_function_with_param_by_ref_called() { LEFT_EXT(IN, L, LEFT__STRING); END_FUNCTION - PROGRAM main + PROGRAM main VAR END_VAR END_PROGRAM @@ -186,34 +186,34 @@ fn test_any_real_called_with_ints() { VAR_INPUT val : REAL; END_VAR - times_two__REAL := val * REAL#2.0; + times_two__REAL := val * REAL#2.0; END_FUNCTION FUNCTION times_two__LREAL : LREAL VAR_INPUT val : LREAL; END_VAR - times_two__LREAL := val * LREAL#2.0; + times_two__LREAL := val * LREAL#2.0; END_FUNCTION - PROGRAM main + PROGRAM main VAR a : REAL; b : LREAL; - c : REAL; - d : REAL; - e : REAL; - f : REAL; + c : REAL; + d : REAL; + e : REAL; + f : REAL; + END_VAR + VAR_TEMP + v_dint : DINT := -6; END_VAR - VAR_TEMP - v_dint : DINT := -6; - END_VAR a := times_two(REAL#2); b := times_two(LREAL#3); - c := times_two(SINT#-4); - d := times_two(UINT#5); - e := times_two(v_dint); - f := times_two(ULINT#7); + c := times_two(SINT#-4); + d := times_two(UINT#5); + e := times_two(v_dint); + f := times_two(ULINT#7); END_PROGRAM "; diff --git a/tests/correctness/initial_values.rs b/tests/correctness/initial_values.rs index 38425e6f6a..448ad25112 100644 --- a/tests/correctness/initial_values.rs +++ b/tests/correctness/initial_values.rs @@ -326,15 +326,15 @@ struct ArrayProgram { #[test] fn initial_values_in_single_dimension_array_variable() { let function = r" - VAR_GLOBAL - a : ARRAY[0..2] OF SINT := [1, 2, 3]; - b : ARRAY[0..2] OF INT := [4, 5, 6]; - c : ARRAY[0..2] OF DINT := [7, 8, 9]; - d : ARRAY[0..2] OF LINT := [10, 11, 12]; - _e : ARRAY[0..2] OF USINT := [13, 14, 15]; - f : ARRAY[0..2] OF UINT := [16, 17, 18]; - g : ARRAY[0..2] OF ULINT := [19, 20, 21]; - h : ARRAY[0..2] OF BOOL := [TRUE, FALSE, FALSE]; + VAR_GLOBAL + a : ARRAY[0..2] OF SINT := [1, 2, 3]; + b : ARRAY[0..2] OF INT := [4, 5, 6]; + c : ARRAY[0..2] OF DINT := [7, 8, 9]; + d : ARRAY[0..2] OF LINT := [10, 11, 12]; + _e : ARRAY[0..2] OF USINT := [13, 14, 15]; + f : ARRAY[0..2] OF UINT := [16, 17, 18]; + g : ARRAY[0..2] OF ULINT := [19, 20, 21]; + h : ARRAY[0..2] OF BOOL := [TRUE, FALSE, FALSE]; END_VAR PROGRAM main @@ -416,8 +416,8 @@ struct MultiDimArrayProgram { #[test] fn initial_values_in_multi_dimension_array_variable() { let function = r" - VAR_GLOBAL - a : ARRAY[0..1, 3..4] OF SINT := [1, 2, 3, 4]; + VAR_GLOBAL + a : ARRAY[0..1, 3..4] OF SINT := [1, 2, 3, 4]; END_VAR PROGRAM main @@ -426,8 +426,8 @@ fn initial_values_in_multi_dimension_array_variable() { a1 : SINT; a2 : SINT; a3 : SINT; - END_VAR - + END_VAR + a0 := a[0,3]; a1 := a[0,4]; a2 := a[1,3]; @@ -459,8 +459,8 @@ struct ArrayOfArrayProgram { #[test] fn initial_values_in_array_of_array_variable() { let function = r" - VAR_GLOBAL - a : ARRAY[0..1] OF ARRAY[0..1] OF ARRAY[0..1] OF SINT := [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]; + VAR_GLOBAL + a : ARRAY[0..1] OF ARRAY[0..1] OF ARRAY[0..1] OF SINT := [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]; END_VAR PROGRAM main @@ -473,8 +473,8 @@ fn initial_values_in_array_of_array_variable() { a6 : SINT; a7 : SINT; a8 : SINT; - END_VAR - + END_VAR + a1 := a[0][0][0]; a2 := a[0][0][1]; a3 := a[0][1][0]; @@ -511,7 +511,7 @@ struct RealsAndFloats { #[test] fn real_initial_values_in_array_variable() { let function = r" - VAR_GLOBAL + VAR_GLOBAL f : ARRAY[0..1] OF REAL := [9.1415, 0.001]; r : ARRAY[0..1] OF LREAL := [9.141592653589, 0.000000001]; END_VAR @@ -522,8 +522,8 @@ fn real_initial_values_in_array_variable() { f2 : REAL; r1 : LREAL; r2 : LREAL; - END_VAR - + END_VAR + f1 := f[0]; f2 := f[1]; r1 := r[0]; @@ -557,7 +557,7 @@ fn initialization_of_complex_struct_instance() { y: DINT; END_STRUCT END_TYPE - + TYPE MyStruct: STRUCT point: MyPoint; my_array: ARRAY[0..3] OF INT; @@ -565,12 +565,12 @@ fn initialization_of_complex_struct_instance() { END_STRUCT END_TYPE - VAR_GLOBAL + VAR_GLOBAL a : MyStruct := ( point := (x := 1, y:= 2), my_array := [0,1,2,3], f := 7.89 - ); + ); END_VAR PROGRAM main @@ -580,7 +580,7 @@ fn initialization_of_complex_struct_instance() { arr1 : INT; arr3 : INT; f : REAL; - END_VAR + END_VAR x := a.point.x; y := a.point.y; @@ -611,7 +611,7 @@ fn initialization_of_complex_struct_instance_using_defaults() { y: DINT := 7; END_STRUCT END_TYPE - + TYPE MyStruct: STRUCT point: MyPoint; my_array: ARRAY[0..3] OF INT; @@ -619,11 +619,11 @@ fn initialization_of_complex_struct_instance_using_defaults() { END_STRUCT END_TYPE - VAR_GLOBAL + VAR_GLOBAL a : MyStruct := ( point := (x := 1), my_array := [0,1,2,3] - ); + ); END_VAR PROGRAM main @@ -633,7 +633,7 @@ fn initialization_of_complex_struct_instance_using_defaults() { arr1 : INT; arr3 : INT; f : REAL; - END_VAR + END_VAR x := a.point.x; y := a.point.y; @@ -679,15 +679,15 @@ fn initialization_of_string_variables() { END_TYPE VAR_GLOBAL g : StringStruct; END_VAR - + PROGRAM main VAR - mystring: MyString := 'xxx'; + mystring: MyString := 'xxx'; mystring2: MyString; string1 : STRING := 'xxx'; string2 : STRING := 'xxx'; string3 : STRING[20]; - END_VAR + END_VAR mystring := g.mystring; mystring2 := g.mystring2; @@ -739,7 +739,7 @@ fn initialization_of_function_variables() { a : DINT; b : DINT := 10; c : ARRAY[0..2] OF DINT := [10,20]; - d : ARRAY[0..2] OF DINT; + d : ARRAY[0..2] OF DINT; END_VAR VAR_INPUT index : INT; @@ -750,8 +750,8 @@ fn initialization_of_function_variables() { ELSIF index = 1 THEN other := b; ELSIF index = 2 THEN - other := c[1]; - ELSE + other := c[1]; + ELSE other := d[0]; END_IF END_FUNCTION @@ -761,12 +761,12 @@ fn initialization_of_function_variables() { a : DINT; b : DINT; c : DINT; - d : DINT; + d : DINT; END_VAR a := other(index := 0); b := other(index := 1); c := other(index := 2); - d := other(index := 3); + d := other(index := 3); END_PROGRAM "; @@ -783,13 +783,13 @@ fn initialization_of_function_variables() { #[test] fn initialization_of_struct_in_fb() { let function = r" - TYPE str : STRUCT - a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; + TYPE str : STRUCT + a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; END_STRUCT END_TYPE VAR_GLOBAL fb : other; END_VAR - FUNCTION_BLOCK other + FUNCTION_BLOCK other VAR a : str; END_VAR @@ -800,7 +800,7 @@ fn initialization_of_struct_in_fb() { a : DINT; b : DINT; c : DINT; - d : DINT; + d : DINT; END_VAR a := fb.a.a; b := fb.a.b; @@ -821,10 +821,10 @@ fn initialization_of_struct_in_fb() { #[test] fn initialization_of_struct_in_prg() { let function = r" - TYPE str : STRUCT - a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; + TYPE str : STRUCT + a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; END_STRUCT END_TYPE - PROGRAM other + PROGRAM other VAR a : str; END_VAR @@ -835,7 +835,7 @@ fn initialization_of_struct_in_prg() { a : DINT; b : DINT; c : DINT; - d : DINT; + d : DINT; END_VAR a := other.a.a; b := other.a.b; @@ -857,8 +857,8 @@ fn initialization_of_struct_in_prg() { #[test] fn initialization_of_struct_ref_in_fb_in_function() { let function = r" - TYPE str : STRUCT - a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; + TYPE str : STRUCT + a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; END_STRUCT END_TYPE FUNCTION_BLOCK fb VAR @@ -878,8 +878,8 @@ fn initialization_of_struct_ref_in_fb_in_function() { ELSIF index = 1 THEN other := x.a.b; ELSIF index = 2 THEN - other := x.a.c; - ELSE + other := x.a.c; + ELSE other := x.a.d; END_IF END_FUNCTION @@ -889,12 +889,12 @@ fn initialization_of_struct_ref_in_fb_in_function() { a : DINT; b : DINT; c : DINT; - d : DINT; + d : DINT; END_VAR a := other(index := 0); b := other(index := 1); c := other(index := 2); - d := other(index := 3); + d := other(index := 3); END_PROGRAM "; @@ -910,8 +910,8 @@ fn initialization_of_struct_ref_in_fb_in_function() { #[test] fn initialization_of_struct_ref_in_function() { let function = r" - TYPE str : STRUCT - a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; + TYPE str : STRUCT + a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; END_STRUCT END_TYPE FUNCTION other : DINT VAR @@ -926,8 +926,8 @@ fn initialization_of_struct_ref_in_function() { ELSIF index = 1 THEN other := a.b; ELSIF index = 2 THEN - other := a.c; - ELSE + other := a.c; + ELSE other := a.d; END_IF END_FUNCTION @@ -937,12 +937,12 @@ fn initialization_of_struct_ref_in_function() { a : DINT; b : DINT; c : DINT; - d : DINT; + d : DINT; END_VAR a := other(index := 0); b := other(index := 1); c := other(index := 2); - d := other(index := 3); + d := other(index := 3); END_PROGRAM "; @@ -961,7 +961,7 @@ fn initialization_of_struct_in_function() { let function = r" FUNCTION other : DINT VAR - a : STRUCT a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; END_STRUCT + a : STRUCT a : DINT := 10; b : DINT := 20; c : DINT := 30; d : DINT; END_STRUCT END_VAR VAR_INPUT index : INT; @@ -972,8 +972,8 @@ fn initialization_of_struct_in_function() { ELSIF index = 1 THEN other := a.b; ELSIF index = 2 THEN - other := a.c; - ELSE + other := a.c; + ELSE other := a.d; END_IF END_FUNCTION @@ -983,12 +983,12 @@ fn initialization_of_struct_in_function() { a : DINT; b : DINT; c : DINT; - d : DINT; + d : DINT; END_VAR a := other(index := 0); b := other(index := 1); c := other(index := 2); - d := other(index := 3); + d := other(index := 3); END_PROGRAM "; @@ -1005,12 +1005,12 @@ fn initialization_of_struct_in_function() { #[test] fn initialized_array_in_function() { let function = " - FUNCTION foo : ARRAY[-1..2] OF DINT - VAR - arr_var : ARRAY[-1..2] OF DINT := [77,20,300,4000]; - END_VAR + FUNCTION foo : ARRAY[-1..2] OF DINT + VAR + arr_var : ARRAY[-1..2] OF DINT := [77,20,300,4000]; + END_VAR foo := arr_var; - END_FUNCTION + END_FUNCTION PROGRAM main VAR_INPUT @@ -1040,10 +1040,10 @@ fn array_test() { u,v,w,x : ULINT; END_VAR - FUNCTION foo : ARRAY[-1..2] OF DINT - VAR_INPUT - arr_var : ARRAY[-1..2] OF DINT; - END_VAR + FUNCTION foo : ARRAY[-1..2] OF DINT + VAR_INPUT + arr_var : ARRAY[-1..2] OF DINT; + END_VAR //main := arr_var; //main[-1] := 1; @@ -1053,14 +1053,14 @@ fn array_test() { x := &(arr_var[3])); main.a := 99; - END_FUNCTION + END_FUNCTION PROGRAM main VAR_INPUT a,b,c,d : ULINT; END_VAR VAR_TEMP - arr_var : ARRAY[-1..2] OF DINT := [77,20,300,4000]; + arr_var : ARRAY[-1..2] OF DINT := [77,20,300,4000]; END_VAR a := 1; b:=2; c:=3; d:=4; @@ -1069,7 +1069,7 @@ fn array_test() { a := u; b := v; c := w; - d := x; + d := x; END_PROGRAM "; @@ -1097,7 +1097,7 @@ fn initialized_array_type_in_function() { END_VAR main := arr_var; END_PROGRAM - "; + "; #[allow(dead_code)] struct MainType { arr: [i32; 4], @@ -1110,19 +1110,19 @@ fn initialized_array_type_in_function() { #[test] fn initialized_array_in_program() { let function = " - PROGRAM target - VAR - arr_var : ARRAY[-1..2] OF DINT := [1,2,3,4]; - END_VAR - END_PROGRAM + PROGRAM target + VAR + arr_var : ARRAY[-1..2] OF DINT := [1,2,3,4]; + END_VAR + END_PROGRAM PROGRAM main VAR - arr_var : ARRAY[-1..2] OF DINT; - END_VAR + arr_var : ARRAY[-1..2] OF DINT; + END_VAR arr_var := target.arr_var; END_PROGRAM - "; + "; #[allow(dead_code)] struct MainType { @@ -1138,20 +1138,20 @@ fn initialized_array_type_in_program() { let function = " TYPE arr : ARRAY[-1..2] OF DINT := [1,2,3,4]; END_TYPE - PROGRAM target - VAR - arr_var : arr; - END_VAR - END_PROGRAM + PROGRAM target + VAR + arr_var : arr; + END_VAR + END_PROGRAM PROGRAM main VAR arr_var : ARRAY[-1..2] OF DINT; END_VAR - + arr_var := target.arr_var; END_PROGRAM - "; + "; #[allow(dead_code)] struct MainType { arr: [i32; 4], @@ -1168,8 +1168,8 @@ fn intial_values_diverge_from_type() { TYPE myInt : DINT := 4; END_TYPE PROGRAM target - VAR - arr_var : arr := [5,6,7,8]; + VAR + arr_var : arr := [5,6,7,8]; i : myInt := 5; END_VAR END_PROGRAM @@ -1182,7 +1182,7 @@ fn intial_values_diverge_from_type() { arr_var := target.arr_var; i := target.i; END_PROGRAM - "; + "; #[allow(dead_code)] struct MainType { arr: [i32; 4], @@ -1201,7 +1201,7 @@ fn initial_value_of_function_return_dint() { // WHEN I only increment the function's return before returning it let function = " - + TYPE myInt : DINT := 4; END_TYPE FUNCTION target : myInt @@ -1212,10 +1212,10 @@ fn initial_value_of_function_return_dint() { VAR i : DINT; END_VAR - + i := target(); END_PROGRAM - "; + "; #[allow(dead_code)] struct MainType { i: i32, @@ -1246,7 +1246,7 @@ fn initial_value_of_function_return_array() { END_VAR arr := target(); END_PROGRAM - "; + "; #[allow(dead_code)] #[repr(C)] @@ -1269,11 +1269,11 @@ fn initial_value_of_function_return_struct() { // WHEN I only increment a by 1, b by 2 and c by 3 before returning it let function = " - - TYPE myStruct : STRUCT - a : DINT := 10; - b : DINT := 20; - c : DINT := 30; + + TYPE myStruct : STRUCT + a : DINT := 10; + b : DINT := 20; + c : DINT := 30; END_STRUCT END_TYPE @@ -1288,13 +1288,13 @@ fn initial_value_of_function_return_struct() { a,b,c : DINT; str : myStruct; END_VAR - + str := target(); a := str.a; b := str.b; c := str.c; END_PROGRAM - "; + "; #[allow(dead_code)] struct MainType { @@ -1351,35 +1351,35 @@ fn initial_value_of_enums() { #[test] fn initial_value_in_array_of_struct() { let function = " - TYPE myStruct : STRUCT - a, b : DINT; - c : ARRAY[0..1] OF DINT; - END_STRUCT - END_TYPE - - VAR_GLOBAL CONSTANT - str : myStruct := (a := 50, b := 60, c := [70, 80]); - END_VAR - - PROGRAM main - VAR_TEMP - arr : ARRAY[0..1] OF myStruct := [(a := 10, b := 20, c := [30, 40]), str]; - END_VAR - VAR - a, b, c, d : DINT; - e, f, g, h : DINT; - END_VAR - a := arr[0].a; - b := arr[0].b; - c := arr[0].c[0]; - d := arr[0].c[1]; - - e := arr[1].a; - f := arr[1].b; - g := arr[1].c[0]; - h := arr[1].c[1]; - END_PROGRAM - "; + TYPE myStruct : STRUCT + a, b : DINT; + c : ARRAY[0..1] OF DINT; + END_STRUCT + END_TYPE + + VAR_GLOBAL CONSTANT + str : myStruct := (a := 50, b := 60, c := [70, 80]); + END_VAR + + PROGRAM main + VAR_TEMP + arr : ARRAY[0..1] OF myStruct := [(a := 10, b := 20, c := [30, 40]), str]; + END_VAR + VAR + a, b, c, d : DINT; + e, f, g, h : DINT; + END_VAR + a := arr[0].a; + b := arr[0].b; + c := arr[0].c[0]; + d := arr[0].c[1]; + + e := arr[1].a; + f := arr[1].b; + g := arr[1].c[0]; + h := arr[1].c[1]; + END_PROGRAM + "; #[allow(dead_code)] #[derive(Default)] diff --git a/tests/correctness/math_operators/addition.rs b/tests/correctness/math_operators/addition.rs index a7ec45e1b7..79fb3f5d61 100644 --- a/tests/correctness/math_operators/addition.rs +++ b/tests/correctness/math_operators/addition.rs @@ -19,7 +19,7 @@ fn adds_in_result_dint_type() { foo := 10 + 50; END_FUNCTION - PROGRAM main + PROGRAM main VAR i1, i2: DINT; END_VAR i1 := 22 + 18; diff --git a/tests/correctness/methods.rs b/tests/correctness/methods.rs index 77351ce2ac..ebd7b87c25 100644 --- a/tests/correctness/methods.rs +++ b/tests/correctness/methods.rs @@ -6,7 +6,7 @@ use crate::{compile_and_run, MainType}; #[ignore = "class/method support postponed"] fn fb_vars_can_be_accessed_from_method() { let src = " -FUNCTION main : DINT +FUNCTION main : DINT prg(); main := prg.y; END_FUNCTION @@ -38,7 +38,7 @@ END_FUNCTION_BLOCK #[ignore = "class support postponed"] fn class_vars_can_be_accessed() { let src = " -FUNCTION main : DINT +FUNCTION main : DINT prg(); main := prg.y; END_FUNCTION @@ -73,8 +73,8 @@ fn method_can_resolve_non_class_functions() { FUNCTION foo : DINT foo := 42; END_FUNCTION - - CLASS baz + + CLASS baz METHOD test : DINT test := foo(); END_METHOD @@ -86,7 +86,7 @@ fn method_can_resolve_non_class_functions() { y := x.test(); END_PROGRAM - FUNCTION main : DINT + FUNCTION main : DINT prg(); main := prg.y; END_FUNCTION diff --git a/tests/correctness/pointers.rs b/tests/correctness/pointers.rs index 1bed05d88d..c81e44f82b 100644 --- a/tests/correctness/pointers.rs +++ b/tests/correctness/pointers.rs @@ -10,16 +10,16 @@ TYPE MyStruct: STRUCT x: DINT; y: DINT; END_STRUCT END_TYPE TYPE MyRef : REF_TO REF_TO DINT; END_TYPE FUNCTION main : DINT - main := foo(); + main := foo(); END_FUNCTION FUNCTION foo : DINT VAR - x : DINT; - s : MyStruct; - u,y : REF_TO DINT; - z : REF_TO REF_TO DINT; - v : MyRef; + x : DINT; + s : MyStruct; + u,y : REF_TO DINT; + z : REF_TO REF_TO DINT; + v : MyRef; END_VAR u := REF(s.x); @@ -47,16 +47,16 @@ TYPE MyStruct: STRUCT x: DINT; y: DINT; END_STRUCT END_TYPE TYPE MyRef : REF_TO REF_TO DINT; END_TYPE FUNCTION main : DINT - main := foo(); + main := foo(); END_FUNCTION FUNCTION foo : DINT VAR - x : DINT; - s : MyStruct; - u,y : REF_TO DINT; - z : REF_TO REF_TO DINT; - v : MyRef; + x : DINT; + s : MyStruct; + u,y : REF_TO DINT; + z : REF_TO REF_TO DINT; + v : MyRef; END_VAR u := &s.x; @@ -97,46 +97,46 @@ fn binary_expressions_for_pointers() { } let function = " - PROGRAM main - VAR - a : CHAR; - b : CHAR; - c : CHAR; - d : CHAR; - e : CHAR; - equal : BOOL; - not_equal : BOOL; - less : BOOL; - greater : BOOL; - less_or_equal : BOOL; - greater_or_equal : BOOL; - END_VAR - VAR_TEMP - arr : ARRAY[0..3] OF CHAR := ['a','b','c','d']; - ptr : REF_TO CHAR; - negative : INT := -1; - END_VAR - ptr := &(arr); - - ptr := ptr + 1 + 1; - a := ptr^; - ptr := ptr + 1; - b := ptr^; - ptr := ptr - 1; - c := ptr^; - ptr := ptr + negative; - d := ptr^; - ptr := ptr - negative; - e := ptr^; - - equal := ptr = ptr; - not_equal := ptr <> ptr; - less := ptr < ptr + 1; - greater := ptr > ptr - 1; - less_or_equal := ptr <= ptr; - greater_or_equal := ptr >= ptr; - END_PROGRAM - "; + PROGRAM main + VAR + a : CHAR; + b : CHAR; + c : CHAR; + d : CHAR; + e : CHAR; + equal : BOOL; + not_equal : BOOL; + less : BOOL; + greater : BOOL; + less_or_equal : BOOL; + greater_or_equal : BOOL; + END_VAR + VAR_TEMP + arr : ARRAY[0..3] OF CHAR := ['a','b','c','d']; + ptr : REF_TO CHAR; + negative : INT := -1; + END_VAR + ptr := &(arr); + + ptr := ptr + 1 + 1; + a := ptr^; + ptr := ptr + 1; + b := ptr^; + ptr := ptr - 1; + c := ptr^; + ptr := ptr + negative; + d := ptr^; + ptr := ptr - negative; + e := ptr^; + + equal := ptr = ptr; + not_equal := ptr <> ptr; + less := ptr < ptr + 1; + greater := ptr > ptr - 1; + less_or_equal := ptr <= ptr; + greater_or_equal := ptr >= ptr; + END_PROGRAM + "; let mut main = Main::default(); let _: i32 = compile_and_run(function, &mut main); assert_eq!(main.a, "c".as_bytes()[0]); @@ -165,25 +165,25 @@ fn binary_expressions_for_pointers_with_function_return() { FUNCTION len : INT len := 1; END_FUNCTION - PROGRAM main - VAR - a : CHAR; + PROGRAM main + VAR + a : CHAR; b : CHAR; c : CHAR; - END_VAR - VAR_TEMP - arr : ARRAY[0..2] OF CHAR := ['a','b', 'c']; - ptr : REF_TO CHAR; - END_VAR - ptr := &arr; - - a := ptr^; - ptr := &arr[0] + len() + 1; - b := ptr^; - ptr := ptr - len() - 1; - c := ptr^; - END_PROGRAM - "; + END_VAR + VAR_TEMP + arr : ARRAY[0..2] OF CHAR := ['a','b', 'c']; + ptr : REF_TO CHAR; + END_VAR + ptr := &arr; + + a := ptr^; + ptr := &arr[0] + len() + 1; + b := ptr^; + ptr := ptr - len() - 1; + c := ptr^; + END_PROGRAM + "; let mut main = Main::default(); let _: i32 = compile_and_run(function, &mut main); assert_eq!(main.a, "a".as_bytes()[0]); @@ -212,30 +212,30 @@ fn value_behind_function_block_pointer_is_assigned_to_correctly() { } let src = r#" - FUNCTION_BLOCK file_t - VAR_INPUT - var1 : BOOL; - var2 : BOOL; - END_VAR - VAR_OUTPUT - out1 : BOOL; - out2 : BOOL; - END_VAR - out1 := var1; - out2 := var2; - END_FUNCTION_BLOCK - - PROGRAM main - VAR - a: BOOL; - b: BOOL; - file : file_t; + FUNCTION_BLOCK file_t + VAR_INPUT + var1 : BOOL; + var2 : BOOL; + END_VAR + VAR_OUTPUT + out1 : BOOL; + out2 : BOOL; + END_VAR + out1 := var1; + out2 := var2; + END_FUNCTION_BLOCK + + PROGRAM main + VAR + a: BOOL; + b: BOOL; + file : file_t; FileOpen : REF_TO file_t; END_VAR - FileOpen := &file; - FileOpen^(var1 := FALSE, var2:=TRUE, out1 => a, out2 => b); + FileOpen := &file; + FileOpen^(var1 := FALSE, var2:=TRUE, out1 => a, out2 => b); END_PROGRAM - "#; + "#; let mut maintype = MainType::default(); let _: i32 = compile_and_run(src, &mut maintype); diff --git a/tests/correctness/pointers/references.rs b/tests/correctness/pointers/references.rs index 01f5bf56d8..86d04a9dae 100644 --- a/tests/correctness/pointers/references.rs +++ b/tests/correctness/pointers/references.rs @@ -45,7 +45,7 @@ fn new() -> MainType { #[test] fn reference_call() { let function = r" - + FUNCTION_BLOCK fbTest VAR_INPUT reference : REF_TO BOOL; (* REF_TO *) @@ -84,7 +84,7 @@ fn reference_call() { in_out2^ := TRUE; END_FUNCTION - + PROGRAM main VAR test: fbTest; @@ -123,7 +123,7 @@ fn reference_call() { r_a^ := FALSE; r_b^:= FALSE; p_c^ := FALSE; p_d^:= FALSE; test(reference := r_a, p := p_c, in_out1 := r_b, in_out2 := p_d); b_result_d := r_a^; b_result_e := r_b^; b_result_f := p_c^; b_result_g := p_d^; - + r_a^ := FALSE; r_b^:= FALSE; p_c^ := FALSE; p_d^:= FALSE; other(reference := r_a, p := p_c, in_out1 := r_b, in_out2 := p_d); b_result_h := r_a^; b_result_i := r_b^; b_result_j := p_c^; b_result_k := p_d^; @@ -241,7 +241,7 @@ fn reference_call_struct() { ref_a : REF_TO MyStruct; (* REF_TO *) ref_b : REF_TO MyStruct; (* REF_TO *) p_a : POINTER TO MyStruct; - p_b : POINTER TO MyStruct; + p_b : POINTER TO MyStruct; b_result_a : BOOL := FALSE; b_result_b : INT := 0; b_result_c : BOOL := FALSE; @@ -253,22 +253,22 @@ fn reference_call_struct() { END_VAR a.field1 := FALSE; a.field2 := 0; b.field1 := FALSE; b.field2 := 0; - + ref_a := &a; ref_b := &b; p_a := &a; p_b := &b; other(reference := ref_a, p:= p_a, in_out1 := ref_b, in_out2 := p_b); - b_result_a := a.field1; + b_result_a := a.field1; b_result_b := a.field2; - b_result_c := b.field1; + b_result_c := b.field1; b_result_d := b.field2; a.field1 := FALSE; a.field2 := 0; b.field1 := FALSE; b.field2 := 0; test(reference := ref_a, p := ref_a, in_out1 := ref_b, in_out2 := ref_b); - b_result_e := a.field1; + b_result_e := a.field1; b_result_f := a.field2; - b_result_g := b.field1; + b_result_g := b.field1; b_result_h := b.field2; END_PROGRAM @@ -375,8 +375,8 @@ fn reference_call_array() { ref_a : REF_TO ARRAY[1..2] OF INT; (* REF_TO *) ref_b : REF_TO ARRAY[1..2] OF INT; (* REF_TO *) p_c : POINTER TO ARRAY[1..2] OF INT; - - p_d : POINTER TO ARRAY[1..2] OF INT; + + p_d : POINTER TO ARRAY[1..2] OF INT; b_result_a : INT := 0; b_result_b : INT := 0; b_result_c : INT := 0; @@ -385,28 +385,28 @@ fn reference_call_array() { b_result_f : INT := 0; b_result_g : INT := 0; b_result_h : INT := 0; - b_result_i : INT := 0; - b_result_j : INT := 0; - b_result_k : INT := 0; - b_result_l : INT := 0; - b_result_m : INT := 0; - b_result_n : INT := 0; - b_result_o : INT := 0; - b_result_p : INT := 0; + b_result_i : INT := 0; + b_result_j : INT := 0; + b_result_k : INT := 0; + b_result_l : INT := 0; + b_result_m : INT := 0; + b_result_n : INT := 0; + b_result_o : INT := 0; + b_result_p : INT := 0; END_VAR ref_a := &a; ref_b := &b; p_c := &c; p_d := &d; - + a[1] := 0; a[2] := 0; b[1] := 0; b[2] := 0; c[1] := 0; c[2] := 0; d[1] := 0; d[2] := 0; - + other(reference := ref_a, p:= p_c, in_out1 := ref_b, in_out2 := p_d); b_result_a := a[1]; b_result_b := a[2]; - b_result_c := b[1]; + b_result_c := b[1]; b_result_d := b[2]; b_result_e := c[1]; b_result_f := c[2]; @@ -417,11 +417,11 @@ fn reference_call_array() { b[1] := 0; b[2] := 0; c[1] := 0; c[2] := 0; d[1] := 0; d[2] := 0; - + test(reference := ref_a, p := p_c, in_out1 := ref_b, in_out2 := p_d); b_result_i := a[1]; b_result_j := a[2]; - b_result_k := b[1]; + b_result_k := b[1]; b_result_l := b[2]; b_result_m := c[1]; b_result_n := c[2]; @@ -467,7 +467,7 @@ fn multiple_pointer_dereference() { END_VAR VAR_TEMP c: REF_TO BYTE; - d: REF_TO REF_TO BYTE; + d: REF_TO REF_TO BYTE; e: BYTE; END_VAR c := &a; diff --git a/tests/correctness/strings.rs b/tests/correctness/strings.rs index 0366123921..58c420d083 100644 --- a/tests/correctness/strings.rs +++ b/tests/correctness/strings.rs @@ -13,9 +13,9 @@ use std::ffi::CStr; fn string_assignment_from_smaller_literal() { let src = r#" PROGRAM main - VAR - x : STRING[6]; - y : WSTRING[6]; + VAR + x : STRING[6]; + y : WSTRING[6]; END_VAR x := 'hello'; y := "hello"; @@ -39,7 +39,7 @@ fn string_assignment_from_smaller_literal() { fn string_assignment_from_bigger_literal() { let src = r#" PROGRAM main - VAR + VAR x : STRING[4]; y : WSTRING[4]; END_VAR @@ -64,10 +64,10 @@ fn string_assignment_from_bigger_literal() { #[test] fn string_assignment_from_smaller_string() { let src = r#" - PROGRAM main - VAR - x : STRING[6]; y : STRING[5]; - u : WSTRING[6]; v : WSTRING[5]; + PROGRAM main + VAR + x : STRING[6]; y : STRING[5]; + u : WSTRING[6]; v : WSTRING[5]; END_VAR y := 'hello'; x := y; @@ -95,9 +95,9 @@ fn string_assignment_from_smaller_string() { fn string_assignment_from_bigger_string() { let src = r#" PROGRAM main - VAR + VAR x : STRING[4]; y : STRING[5]; - u : WSTRING[4]; v : WSTRING[5]; + u : WSTRING[4]; v : WSTRING[5]; END_VAR y := 'hello'; x := y; @@ -295,11 +295,11 @@ fn initialization_of_string_arrays() { PROGRAM main VAR x,y,z : STRING[10]; END_VAR - + x := texts[0]; y := texts[1]; z := texts[2]; - + END_PROGRAM "; @@ -368,10 +368,10 @@ fn string_as_function_parameters_internal() { END_FUNCTION PROGRAM main - VAR - res : STRING; - END_VAR - res := func('hello'); + VAR + res : STRING; + END_VAR + res := func('hello'); END_PROGRAM "; @@ -396,10 +396,10 @@ fn string_as_function_parameters() { END_FUNCTION PROGRAM main - VAR - res : STRING; - END_VAR - res := func('hello'); + VAR + res : STRING; + END_VAR + res := func('hello'); END_PROGRAM "; @@ -427,10 +427,10 @@ fn wstring_as_function_parameters() { END_FUNCTION PROGRAM main - VAR - res : WSTRING; - END_VAR - res := func("hello"); + VAR + res : WSTRING; + END_VAR + res := func("hello"); END_PROGRAM "#; @@ -465,10 +465,10 @@ fn string_as_function_parameters_cast() { END_FUNCTION PROGRAM main - VAR - res : STRING; - END_VAR - res := func(STRING#'hello'); + VAR + res : STRING; + END_VAR + res := func(STRING#'hello'); END_PROGRAM "; @@ -501,10 +501,10 @@ fn wstring_as_function_parameters_cast() { END_FUNCTION PROGRAM main - VAR - res : WSTRING; - END_VAR - res := func(WSTRING#"hello"); + VAR + res : WSTRING; + END_VAR + res := func(WSTRING#"hello"); END_PROGRAM "#; @@ -531,14 +531,14 @@ fn wstring_as_function_parameters_cast() { fn string_as_function_return_type_does_not_truncate() { let src = " FUNCTION foo : STRING[100] - VAR_INPUT + VAR_INPUT str_param : STRING[100]; END_VAR foo := str_param; END_FUNCTION PROGRAM main - VAR + VAR x : STRING[100] END_VAR x := foo(' this is a very long sentence with plenty of characters and weird spacing.') @@ -564,7 +564,7 @@ fn string_as_function_return_type_does_not_truncate() { fn string_ref_returned_from_wrapper_function_does_not_truncate() { let src = " FUNCTION foo : STRING[100] - VAR_INPUT + VAR_INPUT str_param : STRING[100]; END_VAR bar(str_param, foo); @@ -581,7 +581,7 @@ fn string_ref_returned_from_wrapper_function_does_not_truncate() { END_FUNCTION PROGRAM main - VAR + VAR x : STRING[100] END_VAR x := foo(' this is a very long sentence with plenty of characters and weird spacing.') @@ -609,7 +609,7 @@ fn string_returned_from_generic_wrapper_function_does_not_truncate() { FUNCTION foo : T VAR_INPUT {ref} in : T; - END_VAR + END_VAR END_FUNCTION FUNCTION foo__STRING : STRING[100] @@ -629,8 +629,8 @@ fn string_returned_from_generic_wrapper_function_does_not_truncate() { out := in; END_FUNCTION - PROGRAM main - VAR + PROGRAM main + VAR param : STRING[100]; x : STRING[100]; END_VAR @@ -657,7 +657,7 @@ fn string_returned_from_generic_wrapper_function_does_not_truncate() { fn string_returned_from_main_does_not_truncate() { let src = " FUNCTION main : STRING[100] - VAR + VAR param : STRING[100]; END_VAR param := ' this is a very long sentence with plenty of characters and weird spacing.'; @@ -668,9 +668,9 @@ fn string_returned_from_main_does_not_truncate() { let _: u32 = compile_and_run(src, &mut res); assert_eq!( - format!("{res:?}"), + format!("{res:?}"), format!( - "{:?}", + "{:?}", " this is a very long sentence with plenty of characters and weird spacing.\0".as_bytes() ) ) @@ -682,7 +682,7 @@ fn when_function_returns_value_from_generic_function_call_then_string_does_not_t FUNCTION foo : T VAR_INPUT {ref} in : T; - END_VAR + END_VAR END_FUNCTION FUNCTION foo__STRING : STRING[100] @@ -703,20 +703,20 @@ fn when_function_returns_value_from_generic_function_call_then_string_does_not_t END_FUNCTION FUNCTION main : STRING[100] - VAR + VAR param : STRING[100]; END_VAR param := ' this is a very long sentence with plenty of characters and weird spacing.'; - main := foo(param); + main := foo(param); END_FUNCTION "; let mut res: [u8; 101] = [0; 101]; let _: () = compile_and_run(src, &mut res); assert_eq!( - format!("{res:?}"), + format!("{res:?}"), format!( - "{:?}", + "{:?}", " this is a very long sentence with plenty of characters and weird spacing.\0".as_bytes() ) ) @@ -743,20 +743,20 @@ fn when_function_returns_value_from_function_call_string_does_not_truncate() { END_FUNCTION FUNCTION main : STRING[100] - VAR + VAR param : STRING[100]; END_VAR param := ' this is a very long sentence with plenty of characters and weird spacing.'; - main := foo(param); + main := foo(param); END_FUNCTION "; let mut res: [u8; 101] = [0; 101]; let _: () = compile_and_run(src, &mut res); assert_eq!( - format!("{res:?}"), + format!("{res:?}"), format!( - "{:?}", + "{:?}", " this is a very long sentence with plenty of characters and weird spacing.\0".as_bytes() ) ) @@ -765,21 +765,21 @@ fn when_function_returns_value_from_function_call_string_does_not_truncate() { #[test] fn program_string_output() { let src = r#" - PROGRAM prog - VAR_OUTPUT - output1 : STRING; - output2 : WSTRING; - END_VAR - output1 := 'string'; - output2 := "wstring"; - END_PROGRAM + PROGRAM prog + VAR_OUTPUT + output1 : STRING; + output2 : WSTRING; + END_VAR + output1 := 'string'; + output2 := "wstring"; + END_PROGRAM PROGRAM main - VAR - x : STRING[6]; - y : WSTRING[7]; - END_VAR - prog(x, y); + VAR + x : STRING[6]; + y : WSTRING[7]; + END_VAR + prog(x, y); END_PROGRAM "#; @@ -799,7 +799,7 @@ fn program_string_output() { #[test] fn assigning_global_strings_in_function_by_passing_references() { let src = r#" - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_INPUT in : STRING; END_VAR @@ -857,7 +857,7 @@ fn assigning_global_strings_in_function_by_passing_references() { #[test] fn assigning_global_strings_in_function_by_passing_sized_strings() { let src = r#" - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_INPUT in : STRING; END_VAR @@ -915,7 +915,7 @@ fn assigning_global_strings_in_function_by_passing_sized_strings() { #[test] fn assigning_global_strings_in_function_by_passing_literals() { let src = r#" - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_INPUT in : STRING; END_VAR @@ -959,7 +959,7 @@ fn assigning_global_strings_in_function_by_passing_literals() { #[test] fn assigning_by_ref_string_parameters_in_function() { let src = r#" - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_INPUT in : STRING; END_VAR @@ -1011,7 +1011,7 @@ fn assigning_by_ref_string_parameters_in_function() { #[test] fn reassign_strings_after_function_call() { let src = r#" - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_INPUT in : STRING; END_VAR @@ -1063,7 +1063,7 @@ fn reassign_strings_after_function_call() { #[test] fn assigning_global_strings_in_program_by_passing_references() { let src = r#" - PROGRAM prog + PROGRAM prog VAR_INPUT in : STRING; END_VAR @@ -1123,7 +1123,7 @@ fn assigning_global_strings_in_program_by_passing_references() { #[test] fn assigning_global_strings_in_program_by_passing_sized_strigs() { let src = r#" - PROGRAM prog + PROGRAM prog VAR_INPUT in : STRING; END_VAR @@ -1182,7 +1182,7 @@ fn assigning_global_strings_in_program_by_passing_sized_strigs() { #[test] fn assigning_global_strings_in_program_by_passing_literals() { let src = r#" - PROGRAM prog + PROGRAM prog VAR_INPUT in : STRING; END_VAR diff --git a/tests/correctness/sub_range_types.rs b/tests/correctness/sub_range_types.rs index f9a20995a6..95cf13fea4 100644 --- a/tests/correctness/sub_range_types.rs +++ b/tests/correctness/sub_range_types.rs @@ -40,7 +40,7 @@ fn sub_range_chooses_right_implementation() { VAR_INPUT v: ULINT; low: ULINT; up: ULINT; END_VAR CheckLRangeUnsigned := 77; END_FUNCTION - + PROGRAM main VAR a : BYTE(0 .. 100); diff --git a/tests/correctness/vla.rs b/tests/correctness/vla.rs index 2d6f125281..fa60c1324d 100644 --- a/tests/correctness/vla.rs +++ b/tests/correctness/vla.rs @@ -76,7 +76,7 @@ fn variable_length_array_multi_dimension_access() { a := arr[0, 0]; b := arr[0, 1]; c := arr[1, 0]; - d := arr[1, 1]; + d := arr[1, 1]; END_PROGRAM FUNCTION foo : DINT @@ -87,7 +87,7 @@ fn variable_length_array_multi_dimension_access() { vla[0, 0] := 0; vla[0, 1] := 2; vla[1, 0] := 4; - vla[1, 1] := 8; + vla[1, 1] := 8; END_FUNCTION "#; @@ -128,9 +128,9 @@ fn variable_length_array_multi_dimension_read_write() { vla : ARRAY[ *, *, *, *] OF LINT; END_VAR - vla[1, 2, 1, 8] := -7; - vla[2, 1, 1, 6] := 72; - vla[3, 1, 1, 4] := 11; + vla[1, 2, 1, 8] := -7; + vla[2, 1, 1, 6] := 72; + vla[3, 1, 1, 4] := 11; END_FUNCTION "#; @@ -168,7 +168,7 @@ fn variable_length_array_multi_dimension_read_write_with_offsets() { END_PROGRAM FUNCTION foo : DINT - VAR_INPUT + VAR_INPUT vla : ARRAY[ *, *, *, * ] OF LINT; END_VAR @@ -226,7 +226,7 @@ fn consecutive_calls_with_differently_sized_arrays() { END_PROGRAM FUNCTION foo : DINT - VAR_INPUT + VAR_INPUT vla : ARRAY[ *, * ] OF LINT; END_VAR @@ -378,7 +378,7 @@ fn variable_length_array_by_ref_param_access() { e := arr[4]; END_PROGRAM - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_IN_OUT vla : ARRAY[ * ] OF DINT; END_VAR @@ -429,7 +429,7 @@ fn variable_length_array_output_param_access() { e := arr[4]; END_PROGRAM - FUNCTION foo : DINT + FUNCTION foo : DINT VAR_OUTPUT vla : ARRAY[ * ] OF DINT; END_VAR @@ -507,7 +507,7 @@ fn variable_length_array_multi_dimension_with_strings() { a := arr[0, 0]; b := arr[0, 1]; c := arr[1, 0]; - d := arr[1, 1]; + d := arr[1, 1]; END_PROGRAM FUNCTION foo : DINT @@ -518,7 +518,7 @@ fn variable_length_array_multi_dimension_with_strings() { vla[0, 0] := 'brave '; vla[0, 1] := 'new '; vla[1, 0] := 'world '; - vla[1, 1] := '📖'; + vla[1, 1] := '📖'; END_FUNCTION "#; @@ -563,12 +563,12 @@ fn variable_length_array_of_array() { a := arr[0, 0][0]; b := arr[0, 0][1]; c := arr[0, 1][0]; - d := arr[0, 1][1]; - e := arr[1, 0][0]; - f := arr[1, 0][1]; - g := arr[1, 1][0]; - h := arr[1, 1][1]; - + d := arr[0, 1][1]; + e := arr[1, 0][0]; + f := arr[1, 0][1]; + g := arr[1, 1][0]; + h := arr[1, 1][1]; + END_PROGRAM FUNCTION foo : DINT @@ -580,10 +580,10 @@ fn variable_length_array_of_array() { vla[0, 0][1] := 1; vla[0, 1][0] := 2; vla[0, 1][1] := 3; - vla[1, 0][0] := 4; - vla[1, 0][1] := 5; - vla[1, 1][0] := 6; - vla[1, 1][1] := 7; + vla[1, 0][0] := 4; + vla[1, 0][1] := 5; + vla[1, 1][0] := 6; + vla[1, 1][1] := 7; END_FUNCTION "#; @@ -617,7 +617,7 @@ mod builtins { VAR_INPUT {ref} array_1d : ARRAY[*] OF DINT; END_VAR - + foo[0] := LOWER_BOUND(array_1d, 1); foo[1] := UPPER_BOUND(array_1d, 1); END_FUNCTION @@ -632,8 +632,8 @@ mod builtins { array_1d : ARRAY[-5..5] OF DINT; END_VAR - res := foo(array_1d); - + res := foo(array_1d); + lower_1d := res[0]; upper_1d := res[1]; END_PROGRAM @@ -662,7 +662,7 @@ mod builtins { VAR_TEMP i : DINT := 1; END_VAR - + foo[0] := LOWER_BOUND(array_1d, i); foo[1] := UPPER_BOUND(array_1d, i); END_FUNCTION @@ -677,8 +677,8 @@ mod builtins { array_1d : ARRAY[-5..5] OF DINT; END_VAR - res := foo(array_1d); - + res := foo(array_1d); + lower_1d := res[0]; upper_1d := res[1]; END_PROGRAM @@ -705,7 +705,7 @@ mod builtins { VAR_INPUT {ref} arr : ARRAY[*, *] OF DINT; END_VAR - + foo[0] := LOWER_BOUND(arr, 1); foo[1] := UPPER_BOUND(arr, 1); foo[2] := LOWER_BOUND(arr, 2); @@ -723,8 +723,8 @@ mod builtins { array_2d : ARRAY[-5..5, -10..10] OF DINT; END_VAR - res := foo(array_2d); - + res := foo(array_2d); + lower_2d_1 := res[0]; upper_2d_1 := res[1]; lower_2d_2 := res[2]; @@ -760,7 +760,7 @@ mod builtins { i : DINT := 1; j : DINT := 2; END_VAR - + foo[0] := LOWER_BOUND(arr, i); foo[1] := UPPER_BOUND(arr, i); foo[2] := LOWER_BOUND(arr, j); @@ -778,8 +778,8 @@ mod builtins { array_2d : ARRAY[-5..5, -10..10] OF DINT; END_VAR - res := foo(array_2d); - + res := foo(array_2d); + lower_2d_1 := res[0]; upper_2d_1 := res[1]; lower_2d_2 := res[2]; @@ -912,30 +912,30 @@ mod builtins { A1 : ARRAY [1..10] OF INT := [10(1)]; A2 : ARRAY [1..20, -2..2] OF INT := [20(5(1))]; END_VAR - + FUNCTION sum : DINT VAR_IN_OUT A: ARRAY [*] OF INT; END_VAR - + VAR i, sum2 : DINT; END_VAR - + sum2 := 0; FOR i:= LOWER_BOUND(A, 1) TO UPPER_BOUND(A, 1) DO sum2 := sum2 + A[i]; END_FOR - + sum := sum2; END_FUNCTION - + PROGRAM main VAR sum_a1 : DINT; sum_a2 : DINT; END_VAR - + sum_a1 := sum(A1); // sum_a2 := SUM(A2[2]); END_PROGRAM @@ -959,7 +959,7 @@ mod builtins { MY_CONST : DINT := 10; END_VAR - PROGRAM main + PROGRAM main VAR a, b: DINT; END_VAR @@ -970,14 +970,14 @@ mod builtins { b := upper(x); END_FUNCTION - FUNCTION lower : DINT + FUNCTION lower : DINT VAR_INPUT vla : ARRAY[*] OF DINT; END_VAR lower := LOWER_BOUND(vla, MY_CONST - 9); END_FUNCTION - FUNCTION upper : DINT + FUNCTION upper : DINT VAR_INPUT vla : ARRAY[*] OF DINT; END_VAR diff --git a/tests/integration/data/cfc/actions.cfc b/tests/integration/data/cfc/actions.cfc index 34a53e4393..d73e30db99 100644 --- a/tests/integration/data/cfc/actions.cfc +++ b/tests/integration/data/cfc/actions.cfc @@ -7,7 +7,7 @@ PROGRAM main VAR - a,b : DINT; + a,b : DINT; END_VAR @@ -59,21 +59,21 @@ END_VAR - - - - - - - a - - - - - - - 0 - + + + + + + + a + + + + + + + 0 + diff --git a/tests/integration/data/cfc/assigning.st b/tests/integration/data/cfc/assigning.st index c8ee1cd6e2..bee5c2523b 100644 --- a/tests/integration/data/cfc/assigning.st +++ b/tests/integration/data/cfc/assigning.st @@ -7,4 +7,4 @@ END_VAR pt.a := x; pt.b := y; main := pt.a + pt.b -END_PROGRAM \ No newline at end of file +END_PROGRAM diff --git a/tests/integration/data/cfc/chained_calls.cfc b/tests/integration/data/cfc/chained_calls.cfc index 7999894425..5d2c647c1c 100644 --- a/tests/integration/data/cfc/chained_calls.cfc +++ b/tests/integration/data/cfc/chained_calls.cfc @@ -8,7 +8,7 @@ FUNCTION_BLOCK myAdder VAR - x, y: DINT; + x, y: DINT; END_VAR VAR_OUTPUT @@ -18,7 +18,7 @@ END_VAR VAR END_VAR - + diff --git a/tests/integration/data/cfc/chained_calls.st b/tests/integration/data/cfc/chained_calls.st index e6b5d26835..8e9c2d0ceb 100644 --- a/tests/integration/data/cfc/chained_calls.st +++ b/tests/integration/data/cfc/chained_calls.st @@ -17,7 +17,7 @@ END_PROGRAM FUNCTION myAdd : DINT VAR_INPUT - a, b : DINT; + a, b : DINT; END_VAR myAdd := a + b; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/chained_calls_galore.cfc b/tests/integration/data/cfc/chained_calls_galore.cfc index 1b974c3d83..0b393c0350 100644 --- a/tests/integration/data/cfc/chained_calls_galore.cfc +++ b/tests/integration/data/cfc/chained_calls_galore.cfc @@ -298,4 +298,4 @@ END_VAR - \ No newline at end of file + diff --git a/tests/integration/data/cfc/chained_calls_galore.st b/tests/integration/data/cfc/chained_calls_galore.st index e6ad0aacd1..787175208a 100644 --- a/tests/integration/data/cfc/chained_calls_galore.st +++ b/tests/integration/data/cfc/chained_calls_galore.st @@ -11,7 +11,7 @@ END_PROGRAM FUNCTION myAdd : DINT VAR_INPUT - a, b : DINT; + a, b : DINT; END_VAR myAdd := a + b; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/conditional_return.cfc b/tests/integration/data/cfc/conditional_return.cfc index 822d88de38..961b299828 100644 --- a/tests/integration/data/cfc/conditional_return.cfc +++ b/tests/integration/data/cfc/conditional_return.cfc @@ -64,4 +64,4 @@ - \ No newline at end of file + diff --git a/tests/integration/data/cfc/conditional_return_block.cfc b/tests/integration/data/cfc/conditional_return_block.cfc index e54c57eb01..97ed161982 100644 --- a/tests/integration/data/cfc/conditional_return_block.cfc +++ b/tests/integration/data/cfc/conditional_return_block.cfc @@ -86,4 +86,4 @@ - \ No newline at end of file + diff --git a/tests/integration/data/cfc/conditional_return_block_evaluating_false.st b/tests/integration/data/cfc/conditional_return_block_evaluating_false.st index c652aef6ac..2f98c2d579 100644 --- a/tests/integration/data/cfc/conditional_return_block_evaluating_false.st +++ b/tests/integration/data/cfc/conditional_return_block_evaluating_false.st @@ -12,13 +12,13 @@ FUNCTION main : DINT END_FUNCTION FUNCTION MyGT : BOOL - VAR_INPUT - a, b : DINT; - END_VAR + VAR_INPUT + a, b : DINT; + END_VAR - IF a > b THEN - MyGT := TRUE; - ELSE - MyGT := FALSE; - END_IF -END_FUNCTION \ No newline at end of file + IF a > b THEN + MyGT := TRUE; + ELSE + MyGT := FALSE; + END_IF +END_FUNCTION diff --git a/tests/integration/data/cfc/conditional_return_block_evaluating_true.st b/tests/integration/data/cfc/conditional_return_block_evaluating_true.st index f22166eb2d..eaccc3eddf 100644 --- a/tests/integration/data/cfc/conditional_return_block_evaluating_true.st +++ b/tests/integration/data/cfc/conditional_return_block_evaluating_true.st @@ -12,13 +12,13 @@ FUNCTION main : DINT END_FUNCTION FUNCTION MyGT : BOOL - VAR_INPUT - a, b : DINT; - END_VAR + VAR_INPUT + a, b : DINT; + END_VAR - IF a > b THEN - MyGT := TRUE; - ELSE - MyGT := FALSE; - END_IF -END_FUNCTION \ No newline at end of file + IF a > b THEN + MyGT := TRUE; + ELSE + MyGT := FALSE; + END_IF +END_FUNCTION diff --git a/tests/integration/data/cfc/conditional_return_evaluating_false.st b/tests/integration/data/cfc/conditional_return_evaluating_false.st index 41fb9249ff..e7eed61d8f 100644 --- a/tests/integration/data/cfc/conditional_return_evaluating_false.st +++ b/tests/integration/data/cfc/conditional_return_evaluating_false.st @@ -8,4 +8,4 @@ FUNCTION main : DINT conditional(); main := conditional.val; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/conditional_return_evaluating_true.st b/tests/integration/data/cfc/conditional_return_evaluating_true.st index c6af0a9147..fb3631f5c1 100644 --- a/tests/integration/data/cfc/conditional_return_evaluating_true.st +++ b/tests/integration/data/cfc/conditional_return_evaluating_true.st @@ -8,4 +8,4 @@ FUNCTION main : DINT conditional(); main := conditional.val; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/conditional_return_evaluating_true_negated.st b/tests/integration/data/cfc/conditional_return_evaluating_true_negated.st index c6af0a9147..fb3631f5c1 100644 --- a/tests/integration/data/cfc/conditional_return_evaluating_true_negated.st +++ b/tests/integration/data/cfc/conditional_return_evaluating_true_negated.st @@ -8,4 +8,4 @@ FUNCTION main : DINT conditional(); main := conditional.val; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/conditional_return_negated.cfc b/tests/integration/data/cfc/conditional_return_negated.cfc index 39ebf1c1bc..4c827c9d1c 100644 --- a/tests/integration/data/cfc/conditional_return_negated.cfc +++ b/tests/integration/data/cfc/conditional_return_negated.cfc @@ -8,7 +8,7 @@ FUNCTION_BLOCK conditional_return VAR_INPUT - val : DINT; + val : DINT; END_VAR diff --git a/tests/integration/data/cfc/connection.st b/tests/integration/data/cfc/connection.st index eefd89f938..9cedc9b622 100644 --- a/tests/integration/data/cfc/connection.st +++ b/tests/integration/data/cfc/connection.st @@ -1,14 +1,14 @@ FUNCTION main : DINT VAR - value : DINT := 2; + value : DINT := 2; END_VAR - main := myConnection(value); + main := myConnection(value); ; END_FUNCTION FUNCTION myAdd : DINT VAR_INPUT - a, b : DINT; + a, b : DINT; END_VAR - myAdd := a + b; -END_FUNCTION \ No newline at end of file + myAdd := a + b; +END_FUNCTION diff --git a/tests/integration/data/cfc/connection_block_source_multi_sink.cfc b/tests/integration/data/cfc/connection_block_source_multi_sink.cfc index 400436cb08..56b2abf5e8 100644 --- a/tests/integration/data/cfc/connection_block_source_multi_sink.cfc +++ b/tests/integration/data/cfc/connection_block_source_multi_sink.cfc @@ -8,12 +8,12 @@ FUNCTION myConnection : DINT VAR_INPUT - x: DINT; + x: DINT; END_VAR VAR_TEMP - y: DINT; + y: DINT; END_VAR - + diff --git a/tests/integration/data/cfc/connection_var_source_multi_sink.cfc b/tests/integration/data/cfc/connection_var_source_multi_sink.cfc index 7bd768b038..a7787ca0a0 100644 --- a/tests/integration/data/cfc/connection_var_source_multi_sink.cfc +++ b/tests/integration/data/cfc/connection_var_source_multi_sink.cfc @@ -107,4 +107,4 @@ - \ No newline at end of file + diff --git a/tests/integration/data/cfc/duplicate_label.cfc b/tests/integration/data/cfc/duplicate_label.cfc index bf063401d5..6ab8858b8a 100644 --- a/tests/integration/data/cfc/duplicate_label.cfc +++ b/tests/integration/data/cfc/duplicate_label.cfc @@ -1,120 +1,120 @@ - - - - - - - - -FUNCTION main : DINT -VAR - x: BOOL := FALSE; - a: DINT := 0; -END_VAR - - - - - - - - - - - - - x - - - - - - - - - - - - - - - - - - - - - - a - - - - - - - 2 - - - - - - - - a - - - - - - - a + 3 - - - - - - - TRUE - - - - - - - - x - - - - -
Set the jump to false, a should be 5 at the end
-
-
- - - -
This should not be skipped
-
-
- - - - - - - main - - - - - - - a - -
- -
+ + + + + + + + +FUNCTION main : DINT +VAR + x: BOOL := FALSE; + a: DINT := 0; +END_VAR + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + a + + + + + + + 2 + + + + + + + + a + + + + + + + a + 3 + + + + + + + TRUE + + + + + + + + x + + + + +
Set the jump to false, a should be 5 at the end
+
+
+ + + +
This should not be skipped
+
+
+ + + + + + + main + + + + + + + a + +
+ +
diff --git a/tests/integration/data/cfc/function_block_call_fb.cfc b/tests/integration/data/cfc/function_block_call_fb.cfc index 1f43edea3f..7488bb7ab5 100644 --- a/tests/integration/data/cfc/function_block_call_fb.cfc +++ b/tests/integration/data/cfc/function_block_call_fb.cfc @@ -21,7 +21,7 @@ END_VAR VAR END_VAR - + diff --git a/tests/integration/data/cfc/function_block_call_main.cfc b/tests/integration/data/cfc/function_block_call_main.cfc index d5237e8ca8..224ca93c49 100644 --- a/tests/integration/data/cfc/function_block_call_main.cfc +++ b/tests/integration/data/cfc/function_block_call_main.cfc @@ -10,7 +10,7 @@ PROGRAM main VAR fb0 : myFb; END_VAR - + diff --git a/tests/integration/data/cfc/function_returns.cfc b/tests/integration/data/cfc/function_returns.cfc index c1e5eac1b2..403d04fd71 100644 --- a/tests/integration/data/cfc/function_returns.cfc +++ b/tests/integration/data/cfc/function_returns.cfc @@ -38,4 +38,4 @@ END_VAR - \ No newline at end of file + diff --git a/tests/integration/data/cfc/function_returns.st b/tests/integration/data/cfc/function_returns.st index b88418f09a..504dd23a79 100644 --- a/tests/integration/data/cfc/function_returns.st +++ b/tests/integration/data/cfc/function_returns.st @@ -1,3 +1,3 @@ FUNCTION main : DINT main := FuncyReturn(111); -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/jump_false.cfc b/tests/integration/data/cfc/jump_false.cfc index ad357ced66..6261c80f46 100644 --- a/tests/integration/data/cfc/jump_false.cfc +++ b/tests/integration/data/cfc/jump_false.cfc @@ -1,117 +1,117 @@ - - - - - - - - -FUNCTION main : DINT -VAR - x: BOOL := FALSE; - a: DINT := 0; -END_VAR - - - - - - - - - - - - - x - - - - - - - - - - - - - - - - - - - - - a - - - - - - - 2 - - - - - - - - a - - - - - - - a + 3 - - - - - - - FALSE - - - - - - - - x - - - - -
Set the jump to false, a should be 5 at the end
-
-
- - - -
This should not be skipped
-
-
- - - - - - - main - - - - - - - a - -
- -
+ + + + + + + + +FUNCTION main : DINT +VAR + x: BOOL := FALSE; + a: DINT := 0; +END_VAR + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + a + + + + + + + 2 + + + + + + + + a + + + + + + + a + 3 + + + + + + + FALSE + + + + + + + + x + + + + +
Set the jump to false, a should be 5 at the end
+
+
+ + + +
This should not be skipped
+
+
+ + + + + + + main + + + + + + + a + +
+ +
diff --git a/tests/integration/data/cfc/jump_missing_label.cfc b/tests/integration/data/cfc/jump_missing_label.cfc index ccbbd5a731..ceb58d46a5 100644 --- a/tests/integration/data/cfc/jump_missing_label.cfc +++ b/tests/integration/data/cfc/jump_missing_label.cfc @@ -1,117 +1,117 @@ - - - - - - - - -FUNCTION main : DINT -VAR - x: BOOL := FALSE; - a: DINT := 0; -END_VAR - - - - - - - - - - - - - x - - - - - - - - - - - - - - - - - - - - - a - - - - - - - 2 - - - - - - - - a - - - - - - - a + 3 - - - - - - - TRUE - - - - - - - - x - - - - -
Set the jump to false, a should be 5 at the end
-
-
- - - -
This should not be skipped
-
-
- - - - - - - main - - - - - - - a - -
- -
+ + + + + + + + +FUNCTION main : DINT +VAR + x: BOOL := FALSE; + a: DINT := 0; +END_VAR + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + a + + + + + + + 2 + + + + + + + + a + + + + + + + a + 3 + + + + + + + TRUE + + + + + + + + x + + + + +
Set the jump to false, a should be 5 at the end
+
+
+ + + +
This should not be skipped
+
+
+ + + + + + + main + + + + + + + a + +
+ +
diff --git a/tests/integration/data/cfc/jump_no_label.cfc b/tests/integration/data/cfc/jump_no_label.cfc index 32c3838fb6..5b401f61d2 100644 --- a/tests/integration/data/cfc/jump_no_label.cfc +++ b/tests/integration/data/cfc/jump_no_label.cfc @@ -1,114 +1,114 @@ - - - - - - - - -FUNCTION main : DINT + + + + + + + + +FUNCTION main : DINT VAR - x: BOOL := FALSE; - a: DINT := 0; -END_VAR - - - - - - - - - - - - - x - - - - - - - - - - - - - - - - - - - - a - - - - - - - 2 - - - - - - - - a - - - - - - - 3 - - - - - - - TRUE - - - - - - - - x - - - - -
Set the jump to false, a should be 5 at the end
-
-
- - - -
This should not be skipped
-
-
- - - - - - - main - - - - - - - a - -
- -
+ x: BOOL := FALSE; + a: DINT := 0; +END_VAR +
+
+
+
+
+ + + + + + + + x + + + + + + + + + + + + + + + + + + + + a + + + + + + + 2 + + + + + + + + a + + + + + + + 3 + + + + + + + TRUE + + + + + + + + x + + + + +
Set the jump to false, a should be 5 at the end
+
+
+ + + +
This should not be skipped
+
+
+ + + + + + + main + + + + + + + a + +
+ +
diff --git a/tests/integration/data/cfc/jump_true.cfc b/tests/integration/data/cfc/jump_true.cfc index c3622bcad5..3a6f1e362c 100644 --- a/tests/integration/data/cfc/jump_true.cfc +++ b/tests/integration/data/cfc/jump_true.cfc @@ -1,117 +1,117 @@ - - - - - - - - -FUNCTION main : DINT -VAR - x: BOOL := FALSE; - a: DINT := 0; -END_VAR - - - - - - - - - - - - - x - - - - - - - - - - - - - - - - - - - - - a - - - - - - - 2 - - - - - - - - a - - - - - - - a + 3 - - - - - - - TRUE - - - - - - - - x - - - - -
Set the jump to false, a should be 5 at the end
-
-
- - - -
This should not be skipped
-
-
- - - - - - - main - - - - - - - a - -
- -
+ + + + + + + + +FUNCTION main : DINT +VAR + x: BOOL := FALSE; + a: DINT := 0; +END_VAR + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + a + + + + + + + 2 + + + + + + + + a + + + + + + + a + 3 + + + + + + + TRUE + + + + + + + + x + + + + +
Set the jump to false, a should be 5 at the end
+
+
+ + + +
This should not be skipped
+
+
+ + + + + + + main + + + + + + + a + +
+ +
diff --git a/tests/integration/data/cfc/multi_labels.cfc b/tests/integration/data/cfc/multi_labels.cfc index 74baa8c040..b07705ea55 100644 --- a/tests/integration/data/cfc/multi_labels.cfc +++ b/tests/integration/data/cfc/multi_labels.cfc @@ -1,120 +1,120 @@ - - - - - - - - -FUNCTION main : DINT -VAR - x: BOOL := FALSE; - a: DINT := 0; -END_VAR - - - - - - - - - - - - - x - - - - - - - - - - - - - - - - - - - - - - a - - - - - - - 2 - - - - - - - - a - - - - - - - a + 3 - - - - - - - TRUE - - - - - - - - x - - - - -
Set the jump to false, a should be 5 at the end
-
-
- - - -
This should not be skipped
-
-
- - - - - - - main - - - - - - - a - -
- -
+ + + + + + + + +FUNCTION main : DINT +VAR + x: BOOL := FALSE; + a: DINT := 0; +END_VAR + + + + + + + + + + + + + x + + + + + + + + + + + + + + + + + + + + + + a + + + + + + + 2 + + + + + + + + a + + + + + + + a + 3 + + + + + + + TRUE + + + + + + + + x + + + + +
Set the jump to false, a should be 5 at the end
+
+
+ + + +
This should not be skipped
+
+
+ + + + + + + main + + + + + + + a + +
+ +
diff --git a/tests/integration/data/cfc/my_add.cfc b/tests/integration/data/cfc/my_add.cfc index f9fcb55ca2..50d33f827c 100644 --- a/tests/integration/data/cfc/my_add.cfc +++ b/tests/integration/data/cfc/my_add.cfc @@ -8,7 +8,7 @@ FUNCTION_BLOCK myAdder VAR - x, y: DINT; + x, y: DINT; END_VAR VAR_OUTPUT @@ -18,7 +18,7 @@ END_VAR VAR END_VAR - + diff --git a/tests/integration/data/cfc/my_add.st b/tests/integration/data/cfc/my_add.st index ebd7360332..e6b159c6bf 100644 --- a/tests/integration/data/cfc/my_add.st +++ b/tests/integration/data/cfc/my_add.st @@ -14,7 +14,7 @@ END_PROGRAM FUNCTION myAdd : DINT VAR_INPUT - a, b : DINT; + a, b : DINT; END_VAR myAdd := a + b; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/cfc/select.cfc b/tests/integration/data/cfc/select.cfc index bbb6ce3f9e..544082399f 100644 --- a/tests/integration/data/cfc/select.cfc +++ b/tests/integration/data/cfc/select.cfc @@ -9,12 +9,12 @@ FUNCTION_BLOCK select VAR_INPUT - a, b : DINT; + a, b : DINT; END_VAR VAR - selected: DINT; + selected: DINT; END_VAR - + diff --git a/tests/integration/data/cfc/select.st b/tests/integration/data/cfc/select.st index 8df01a4db6..a1c4364a7f 100644 --- a/tests/integration/data/cfc/select.st +++ b/tests/integration/data/cfc/select.st @@ -8,4 +8,4 @@ END_VAR selector(x, y); // expecting y main := selector.selected; -END_PROGRAM \ No newline at end of file +END_PROGRAM diff --git a/tests/integration/data/cfc/variable_assignment.cfc b/tests/integration/data/cfc/variable_assignment.cfc index 9d0a394e68..e3316beb05 100644 --- a/tests/integration/data/cfc/variable_assignment.cfc +++ b/tests/integration/data/cfc/variable_assignment.cfc @@ -34,4 +34,4 @@ END_VAR - \ No newline at end of file + diff --git a/tests/integration/data/cfc/variable_assignment.st b/tests/integration/data/cfc/variable_assignment.st index 99a9d9175a..5e7393372c 100644 --- a/tests/integration/data/cfc/variable_assignment.st +++ b/tests/integration/data/cfc/variable_assignment.st @@ -9,4 +9,4 @@ END_VAR assign(); // b := a main := assign.b; -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/command_line.st b/tests/integration/data/command_line.st index 0eb2a1dbca..469acbf435 100644 --- a/tests/integration/data/command_line.st +++ b/tests/integration/data/command_line.st @@ -1,5 +1,5 @@ FUNCTION myFunc : DINT VAR_INPUT - a,b,c : DINT; + a,b,c : DINT; END_VAR END_FUNCTION diff --git a/tests/integration/data/io.st b/tests/integration/data/io.st index 83f9f5e496..17bb8ee574 100644 --- a/tests/integration/data/io.st +++ b/tests/integration/data/io.st @@ -1,6 +1,6 @@ PROGRAM a VAR - binvar AT %IX7.8 : BOOL; + binvar AT %IX7.8 : BOOL; sinvar AT %IB4.8 : BYTE; winvar AT %IW3.1 : WORD; dinvar AT %ID1.7 : DWORD; diff --git a/tests/integration/data/json/build_cc_linker.json b/tests/integration/data/json/build_cc_linker.json index 17af4a4fd0..f1310a4908 100644 --- a/tests/integration/data/json/build_cc_linker.json +++ b/tests/integration/data/json/build_cc_linker.json @@ -4,4 +4,4 @@ "simple_program.st" ], "compile_type": "Shared" -} \ No newline at end of file +} diff --git a/tests/integration/data/json/build_clang_windows.json b/tests/integration/data/json/build_clang_windows.json index d45121baea..327163c390 100644 --- a/tests/integration/data/json/build_clang_windows.json +++ b/tests/integration/data/json/build_clang_windows.json @@ -14,4 +14,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/tests/integration/data/json/build_to_temp.json b/tests/integration/data/json/build_to_temp.json index 5907686b2b..53e390dca6 100644 --- a/tests/integration/data/json/build_to_temp.json +++ b/tests/integration/data/json/build_to_temp.json @@ -23,4 +23,4 @@ } ], "output": "proj.so" -} \ No newline at end of file +} diff --git a/tests/integration/data/json/build_without_sysroot.json b/tests/integration/data/json/build_without_sysroot.json index 492c9dfd5b..a2f2dc9f38 100644 --- a/tests/integration/data/json/build_without_sysroot.json +++ b/tests/integration/data/json/build_without_sysroot.json @@ -5,4 +5,4 @@ ], "compile_type": "Shared", "output": "proj.so" -} \ No newline at end of file +} diff --git a/tests/integration/data/json/multi_target_and_sysroot.json b/tests/integration/data/json/multi_target_and_sysroot.json index 492c9dfd5b..a2f2dc9f38 100644 --- a/tests/integration/data/json/multi_target_and_sysroot.json +++ b/tests/integration/data/json/multi_target_and_sysroot.json @@ -5,4 +5,4 @@ ], "compile_type": "Shared", "output": "proj.so" -} \ No newline at end of file +} diff --git a/tests/integration/data/json/separate_build_and_lib.json b/tests/integration/data/json/separate_build_and_lib.json index 03713a4236..6e59d2076c 100644 --- a/tests/integration/data/json/separate_build_and_lib.json +++ b/tests/integration/data/json/separate_build_and_lib.json @@ -23,4 +23,4 @@ } ], "output": "proj.so" -} \ No newline at end of file +} diff --git a/tests/integration/data/json/simple_program.st b/tests/integration/data/json/simple_program.st index 3f89442478..4d45f7e3f6 100644 --- a/tests/integration/data/json/simple_program.st +++ b/tests/integration/data/json/simple_program.st @@ -1,8 +1,8 @@ PROGRAM prg VAR - a : INT; - b : REAL; + a : INT; + b : REAL; END_VAR - b := 1.5; - a := b; + b := 1.5; + a := b; END_PROGRAM diff --git a/tests/integration/data/linking/consts.st b/tests/integration/data/linking/consts.st index 362fc47864..17e9c05522 100644 --- a/tests/integration/data/linking/consts.st +++ b/tests/integration/data/linking/consts.st @@ -1,4 +1,3 @@ VAR_GLOBAL CONSTANT - myValue : BOOL := TRUE; + myValue : BOOL := TRUE; END_VAR - diff --git a/tests/integration/data/linking/file1.st b/tests/integration/data/linking/file1.st index b0b2e2c902..32cc235445 100644 --- a/tests/integration/data/linking/file1.st +++ b/tests/integration/data/linking/file1.st @@ -3,6 +3,5 @@ FUNCTION func2 : DINT END_FUNCTION FUNCTION func1 : DINT - func2(); + func2(); END_FUNCTION - diff --git a/tests/integration/data/linking/file2.st b/tests/integration/data/linking/file2.st index 583792532f..ddd53a4647 100644 --- a/tests/integration/data/linking/file2.st +++ b/tests/integration/data/linking/file2.st @@ -3,6 +3,5 @@ FUNCTION func1 : DINT END_FUNCTION FUNCTION func2 : DINT - func1(); + func1(); END_FUNCTION - diff --git a/tests/integration/data/linking/folder1/vars.st b/tests/integration/data/linking/folder1/vars.st index 362fc47864..17e9c05522 100644 --- a/tests/integration/data/linking/folder1/vars.st +++ b/tests/integration/data/linking/folder1/vars.st @@ -1,4 +1,3 @@ VAR_GLOBAL CONSTANT - myValue : BOOL := TRUE; + myValue : BOOL := TRUE; END_VAR - diff --git a/tests/integration/data/linking/folder2/vars.st b/tests/integration/data/linking/folder2/vars.st index 06ca4f07f0..2850c62564 100644 --- a/tests/integration/data/linking/folder2/vars.st +++ b/tests/integration/data/linking/folder2/vars.st @@ -1,4 +1,3 @@ VAR_GLOBAL CONSTANT - myValue2 : BOOL := TRUE; + myValue2 : BOOL := TRUE; END_VAR - diff --git a/tests/integration/data/linking/init.st b/tests/integration/data/linking/init.st index e7ba69f434..7308791155 100644 --- a/tests/integration/data/linking/init.st +++ b/tests/integration/data/linking/init.st @@ -1,5 +1,5 @@ -TYPE myStruct : STRUCT - a : INT := 5; - b : DINT := 6; +TYPE myStruct : STRUCT + a : INT := 5; + b : DINT := 6; END_STRUCT END_TYPE diff --git a/tests/integration/data/linking/init2.st b/tests/integration/data/linking/init2.st index 584d322a3a..8fac7f64df 100644 --- a/tests/integration/data/linking/init2.st +++ b/tests/integration/data/linking/init2.st @@ -1,5 +1,5 @@ FUNCTION_BLOCK myFB - VAR - myS : myStruct := (a := 2); - END_VAR + VAR + myS : myStruct := (a := 2); + END_VAR END_FUNCTION_BLOCK diff --git a/tests/integration/data/linking/init3.st b/tests/integration/data/linking/init3.st index 5f339743eb..d1fb1ce4a6 100644 --- a/tests/integration/data/linking/init3.st +++ b/tests/integration/data/linking/init3.st @@ -1,5 +1,5 @@ FUNCTION_BLOCK myFb2 - VAR - fb : myFb; - END_VAR + VAR + fb : myFb; + END_VAR END_FUNCTION_BLOCK diff --git a/tests/integration/data/multi/concat_date.st b/tests/integration/data/multi/concat_date.st index dc85ca0107..d939a626fd 100644 --- a/tests/integration/data/multi/concat_date.st +++ b/tests/integration/data/multi/concat_date.st @@ -1,8 +1,8 @@ {external} FUNCTION CONCAT_DATE : DATE VAR_INPUT - year : T; - month : T; - day : T; + year : T; + month : T; + day : T; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/multi/concat_date_prg1.st b/tests/integration/data/multi/concat_date_prg1.st index 74957761a0..407cbb441e 100644 --- a/tests/integration/data/multi/concat_date_prg1.st +++ b/tests/integration/data/multi/concat_date_prg1.st @@ -1,3 +1,3 @@ FUNCTION foo1 : LINT foo1 := CONCAT_DATE(INT#1, SINT#2, SINT#3); -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/multi/concat_date_prg2.st b/tests/integration/data/multi/concat_date_prg2.st index cd636909d5..9827a155f9 100644 --- a/tests/integration/data/multi/concat_date_prg2.st +++ b/tests/integration/data/multi/concat_date_prg2.st @@ -1,3 +1,3 @@ FUNCTION foo2 : LINT foo2 := CONCAT_DATE(INT#4, SINT#5, SINT#6); -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/tests/integration/data/multi/prog.st b/tests/integration/data/multi/prog.st index 50572fe223..cafd17dc7d 100644 --- a/tests/integration/data/multi/prog.st +++ b/tests/integration/data/multi/prog.st @@ -1,6 +1,6 @@ PROGRAM mainProg VAR - a: DINT := 0; + a: DINT := 0; END_VAR a := 42; END_PROGRAM diff --git a/xtask/.gitignore b/xtask/.gitignore index 5f32e705c4..14ee5009d7 100644 --- a/xtask/.gitignore +++ b/xtask/.gitignore @@ -1,2 +1,2 @@ target/ -.env \ No newline at end of file +.env diff --git a/xtask/README.md b/xtask/README.md index 0716eac56b..c7d2524f60 100644 --- a/xtask/README.md +++ b/xtask/README.md @@ -9,4 +9,4 @@ This directory contains the following [xtasks](https://github.com/matklad/cargo-
-
\ No newline at end of file + diff --git a/xtask/migrations/20230620132156_benchmarks.sql b/xtask/migrations/20230620132156_benchmarks.sql index 132f8b75cb..c5c5de0bd1 100644 --- a/xtask/migrations/20230620132156_benchmarks.sql +++ b/xtask/migrations/20230620132156_benchmarks.sql @@ -16,10 +16,10 @@ CREATE TABLE Report( ); CREATE TABLE Metric ( - id SERIAL, - name TEXT NOT NULL, - `time` BIGINT UNSIGNED NOT NULL, + id SERIAL, + name TEXT NOT NULL, + `time` BIGINT UNSIGNED NOT NULL, report_id BIGINT UNSIGNED NOT NULL, - CONSTRAINT Metric_pk PRIMARY KEY (id), - CONSTRAINT Metric_FK FOREIGN KEY (report_id) REFERENCES Report(id) ON DELETE CASCADE ON UPDATE CASCADE -); \ No newline at end of file + CONSTRAINT Metric_pk PRIMARY KEY (id), + CONSTRAINT Metric_FK FOREIGN KEY (report_id) REFERENCES Report(id) ON DELETE CASCADE ON UPDATE CASCADE +); diff --git a/xtask/res/ARCH.drawio b/xtask/res/ARCH.drawio index e6d511a221..95083510fe 100644 --- a/xtask/res/ARCH.drawio +++ b/xtask/res/ARCH.drawio @@ -1 +1 @@ -3VhNT+MwEP01kXYPVPls02MpBQ6gRRQJcUJO4iYG145sp1+/fu3ESRrSlrJQWvZU+2U8tt/MPI9qOMPp4oqBNLmlEcSGbUYLw7kwbNsyXV/+KGRZIJ5nFUDMUKSNamCMVrBcqdEMRZA3DAWlWKC0CYaUEBiKBgYYo/Om2YTi5q4piGELGIcAt9FHFImkQH27V+PXEMVJubPV7RdfpqA01jfhCYjofA1yRoYzZJSKYjRdDCFW5JW8FOsut3ytDsYgEfsseGCr0bh38fT8FN0nj6tZL3gYnDmFlxnAmb6wPqxYlgzASBKip5SJhMaUADyq0XNGMxJBtY0pZ7XNDaWpBC0JvkAhljq6IBNUQomYYv212FNttPVuGuI0YyHccaEyRwCLodhhZ1cRkKkL6RQKtpTrGMRAoFnzHEDnUFzZ1TTLgWb6A6yXyb1G+wNDcQwZ30j/DQhkWTUoAxjFRI5DyRBkEphBJpDM24H+MEVRVEQHcrQCQe5PxSeliIj8Rt654V1U9CsHcGFsKCq9uE7l9cBsT6s2u9q72bHdwtGysd3e5GvPd+omtduKVu31rN/0QCcTLnPibfCq830inq1w3mU8yaUqVwKuQvQ2sHXVqHjOEyTgOAV5cs+llm6qkA0hatXIVtb9Jjt2T8/ntaxZZYCTNUnzzANVgffDpcbeU2rco0pNOzfvM/KfyIz3jsyYVrd3CKHpHktneifxXEMSDVRrJaeEElggl0jdJXd5hBrbIn3fU2N2Kyq30i8KZZWZj5S9TrDkyu5ieYHzQD4E3ViNfl0hcZ0F0mYQCkTJ76O/EKf3RLgtZkOZCepRXQjAX9XjWjJ9ZO7ck+Ou/8OfV3fP0vc/WfqbNd42m/H0fLfpoji/XnUAqW+LypBiLJ9JpSoigfkVeYbV/K20ABKpk6ap1GVlTolqRLtgqvKeBDytIvXTO4D+zqI8ky1At2wB/jUhyoL+rkfebwVea1znhVPSChtPQKqG4RIjWbvMeV/ugqLKb4IKAOFrnNf+n0xIN1DjvChzy/sijez7nZ7XKCvHb8ukb3e8tk5a1qGE0jqKUq41USEGnKOw0Ufl9EvtE22jHF4z+0LNtfxvEt3PBaxdIpdMahzMZW9Xp3UHYnh6fZZrVRn/Xrfgeh/m1FDklH8yFiJV/1XrjP4C \ No newline at end of file +3VhNT+MwEP01kXYPVPls02MpBQ6gRRQJcUJO4iYG145sp1+/fu3ESRrSlrJQWvZU+2U8tt/MPI9qOMPp4oqBNLmlEcSGbUYLw7kwbNsyXV/+KGRZIJ5nFUDMUKSNamCMVrBcqdEMRZA3DAWlWKC0CYaUEBiKBgYYo/Om2YTi5q4piGELGIcAt9FHFImkQH27V+PXEMVJubPV7RdfpqA01jfhCYjofA1yRoYzZJSKYjRdDCFW5JW8FOsut3ytDsYgEfsseGCr0bh38fT8FN0nj6tZL3gYnDmFlxnAmb6wPqxYlgzASBKip5SJhMaUADyq0XNGMxJBtY0pZ7XNDaWpBC0JvkAhljq6IBNUQomYYv212FNttPVuGuI0YyHccaEyRwCLodhhZ1cRkKkL6RQKtpTrGMRAoFnzHEDnUFzZ1TTLgWb6A6yXyb1G+wNDcQwZ30j/DQhkWTUoAxjFRI5DyRBkEphBJpDM24H+MEVRVEQHcrQCQe5PxSeliIj8Rt654V1U9CsHcGFsKCq9uE7l9cBsT6s2u9q72bHdwtGysd3e5GvPd+omtduKVu31rN/0QCcTLnPibfCq830inq1w3mU8yaUqVwKuQvQ2sHXVqHjOEyTgOAV5cs+llm6qkA0hatXIVtb9Jjt2T8/ntaxZZYCTNUnzzANVgffDpcbeU2rco0pNOzfvM/KfyIz3jsyYVrd3CKHpHktneifxXEMSDVRrJaeEElggl0jdJXd5hBrbIn3fU2N2Kyq30i8KZZWZj5S9TrDkyu5ieYHzQD4E3ViNfl0hcZ0F0mYQCkTJ76O/EKf3RLgtZkOZCepRXQjAX9XjWjJ9ZO7ck+Ou/8OfV3fP0vc/WfqbNd42m/H0fLfpoji/XnUAqW+LypBiLJ9JpSoigfkVeYbV/K20ABKpk6ap1GVlTolqRLtgqvKeBDytIvXTO4D+zqI8ky1At2wB/jUhyoL+rkfebwVea1znhVPSChtPQKqG4RIjWbvMeV/ugqLKb4IKAOFrnNf+n0xIN1DjvChzy/sijez7nZ7XKCvHb8ukb3e8tk5a1qGE0jqKUq41USEGnKOw0Ufl9EvtE22jHF4z+0LNtfxvEt3PBaxdIpdMahzMZW9Xp3UHYnh6fZZrVRn/Xrfgeh/m1FDklH8yFiJV/1XrjP4C diff --git a/xtask/res/ARCH.svg b/xtask/res/ARCH.svg index 95cd93475b..6573a5358f 100644 --- a/xtask/res/ARCH.svg +++ b/xtask/res/ARCH.svg @@ -1,4 +1,4 @@ -
Triggers
Triggers
Push to master
Push to master
Runs
Runs
Metrics Workflow
(GitHub Action)
Metrics Workflow...
cargo xtask metrics
cargo xtask metrics
Collects the results
and appends onto 
Collects the results...
metrics.json
metrics.json
Frontend
(GitHub Page)
Frontend...
Text is not SVG - cannot display
\ No newline at end of file +
Triggers
Triggers
Push to master
Push to master
Runs
Runs
Metrics Workflow
(GitHub Action)
Metrics Workflow...
cargo xtask metrics
cargo xtask metrics
Collects the results
and appends onto 
Collects the results...
metrics.json
metrics.json
Frontend
(GitHub Page)
Frontend...
Text is not SVG - cannot display
diff --git a/xtask/res/combined.st b/xtask/res/combined.st index 146c26124b..697875f6b6 100644 --- a/xtask/res/combined.st +++ b/xtask/res/combined.st @@ -6,8 +6,8 @@ {external} FUNCTION CONCAT_DATE_TOD : DT VAR_INPUT - date_input : DATE; - tod_input : TOD; + date_input : DATE; + tod_input : TOD; END_VAR END_FUNCTION @@ -18,10 +18,10 @@ END_FUNCTION ******************** *) FUNCTION CONCAT_DATE_LTOD : DT VAR_INPUT - date_input : DATE; - tod_input : LTOD; + date_input : DATE; + tod_input : LTOD; END_VAR - CONCAT_DATE_LTOD := CONCAT_DATE_TOD(date_input, tod_input); + CONCAT_DATE_LTOD := CONCAT_DATE_TOD(date_input, tod_input); END_FUNCTION (******************** @@ -32,9 +32,9 @@ END_FUNCTION {external} FUNCTION CONCAT_DATE < T : ANY_INT > : DATE VAR_INPUT - year : T; - month : T; - day : T; + year : T; + month : T; + day : T; END_VAR END_FUNCTION @@ -46,10 +46,10 @@ END_FUNCTION {external} FUNCTION CONCAT_TOD < T : ANY_INT > : TOD VAR_INPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -60,99 +60,99 @@ END_FUNCTION ******************** *) FUNCTION CONCAT_LTOD < T : ANY_INT > : LTOD VAR_INPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of CONCAT_LTOD for SINT *) FUNCTION CONCAT_LTOD__SINT : LTOD VAR_INPUT - hour : SINT; - minute : SINT; - second : SINT; - millisecond : SINT; + hour : SINT; + minute : SINT; + second : SINT; + millisecond : SINT; END_VAR - CONCAT_LTOD__SINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__SINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for USINT *) FUNCTION CONCAT_LTOD__USINT : LTOD VAR_INPUT - hour : USINT; - minute : USINT; - second : USINT; - millisecond : USINT; + hour : USINT; + minute : USINT; + second : USINT; + millisecond : USINT; END_VAR - CONCAT_LTOD__USINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__USINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for INT *) FUNCTION CONCAT_LTOD__INT : LTOD VAR_INPUT - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - CONCAT_LTOD__INT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__INT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for UINT *) FUNCTION CONCAT_LTOD__UINT : LTOD VAR_INPUT - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - CONCAT_LTOD__UINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__UINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for DINT *) FUNCTION CONCAT_LTOD__DINT : LTOD VAR_INPUT - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - CONCAT_LTOD__DINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__DINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for UDINT *) FUNCTION CONCAT_LTOD__UDINT : LTOD VAR_INPUT - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - CONCAT_LTOD__UDINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__UDINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for LINT *) FUNCTION CONCAT_LTOD__LINT : LTOD VAR_INPUT - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - CONCAT_LTOD__LINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__LINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of CONCAT_LTOD for ULINT *) FUNCTION CONCAT_LTOD__ULINT : LTOD VAR_INPUT - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - CONCAT_LTOD__ULINT := CONCAT_TOD(hour, minute, second, millisecond); + CONCAT_LTOD__ULINT := CONCAT_TOD(hour, minute, second, millisecond); END_FUNCTION (******************** @@ -162,98 +162,98 @@ END_FUNCTION ******************** *) FUNCTION CONCAT_DT < T : ANY_INT > : DT VAR_INPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of CONCAT_DT for INT *) FUNCTION CONCAT_DT__INT : DT VAR_INPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - CONCAT_DT__INT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__INT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for UINT *) FUNCTION CONCAT_DT__UINT : DT VAR_INPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - CONCAT_DT__UINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__UINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for DINT *) FUNCTION CONCAT_DT__DINT : DT VAR_INPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - CONCAT_DT__DINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__DINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for UDINT *) FUNCTION CONCAT_DT__UDINT : DT VAR_INPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - CONCAT_DT__UDINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__UDINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for LINT *) FUNCTION CONCAT_DT__LINT : DT VAR_INPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - CONCAT_DT__LINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__LINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_DT for ULINT *) FUNCTION CONCAT_DT__ULINT : DT VAR_INPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - CONCAT_DT__ULINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); + CONCAT_DT__ULINT := CONCAT_DATE_TOD(CONCAT_DATE(year, month, day), CONCAT_TOD(hour, minute, second, millisecond)); END_FUNCTION (******************** @@ -263,98 +263,98 @@ END_FUNCTION ******************** *) FUNCTION CONCAT_LDT < T : ANY_INT > : LDT VAR_INPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of CONCAT_LDT for INT *) FUNCTION CONCAT_LDT__INT : LDT VAR_INPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - CONCAT_LDT__INT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__INT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for UINT *) FUNCTION CONCAT_LDT__UINT : LDT VAR_INPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - CONCAT_LDT__UINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__UINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for DINT *) FUNCTION CONCAT_LDT__DINT : LDT VAR_INPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - CONCAT_LDT__DINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__DINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for UDINT *) FUNCTION CONCAT_LDT__UDINT : LDT VAR_INPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - CONCAT_LDT__UDINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__UDINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for LINT *) FUNCTION CONCAT_LDT__LINT : LDT VAR_INPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - CONCAT_LDT__LINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__LINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (* Specialized implementation of CONCAT_LDT for ULINT *) FUNCTION CONCAT_LDT__ULINT : LDT VAR_INPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - CONCAT_LDT__ULINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); + CONCAT_LDT__ULINT := CONCAT_DATE_LTOD(CONCAT_DATE(year, month, day), CONCAT_LTOD(hour, minute, second, millisecond)); END_FUNCTION (******************** @@ -364,12 +364,12 @@ END_FUNCTION ******************** *) FUNCTION SPLIT_DATE < T : ANY_INT > : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : T; - month : T; - day : T; + year : T; + month : T; + day : T; END_VAR END_FUNCTION @@ -377,12 +377,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__INT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : INT; - month : INT; - day : INT; + year : INT; + month : INT; + day : INT; END_VAR END_FUNCTION @@ -390,12 +390,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__UINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : UINT; - month : UINT; - day : UINT; + year : UINT; + month : UINT; + day : UINT; END_VAR END_FUNCTION @@ -403,12 +403,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__DINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : DINT; - month : DINT; - day : DINT; + year : DINT; + month : DINT; + day : DINT; END_VAR END_FUNCTION @@ -416,12 +416,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__UDINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : UDINT; - month : UDINT; - day : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; END_VAR END_FUNCTION @@ -429,12 +429,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__LINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : LINT; - month : LINT; - day : LINT; + year : LINT; + month : LINT; + day : LINT; END_VAR END_FUNCTION @@ -442,12 +442,12 @@ END_FUNCTION {external} FUNCTION SPLIT_DATE__ULINT : INT VAR_INPUT - in : DATE; + in : DATE; END_VAR VAR_OUTPUT - year : ULINT; - month : ULINT; - day : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; END_VAR END_FUNCTION @@ -458,13 +458,13 @@ END_FUNCTION ******************** *) FUNCTION SPLIT_TOD < T : ANY_INT > : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -472,13 +472,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__INT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR END_FUNCTION @@ -486,13 +486,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__UINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR END_FUNCTION @@ -500,13 +500,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__DINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR END_FUNCTION @@ -514,13 +514,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__UDINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR END_FUNCTION @@ -528,13 +528,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__LINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR END_FUNCTION @@ -542,13 +542,13 @@ END_FUNCTION {external} FUNCTION SPLIT_TOD__ULINT : INT VAR_INPUT - in : TOD; + in : TOD; END_VAR VAR_OUTPUT - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR END_FUNCTION @@ -559,98 +559,98 @@ END_FUNCTION ******************** *) FUNCTION SPLIT_LTOD < T : ANY_INT > : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : T; - minute : T; - second : T; - millisecond : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION (* Specialized implementation of SPLIT_LTOD for INT *) FUNCTION SPLIT_LTOD__INT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - SPLIT_LTOD__INT := SPLIT_TOD__INT(in, hour, minute, second, millisecond); + SPLIT_LTOD__INT := SPLIT_TOD__INT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for UINT *) FUNCTION SPLIT_LTOD__UINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - SPLIT_LTOD__UINT := SPLIT_TOD__UINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__UINT := SPLIT_TOD__UINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for DINT *) FUNCTION SPLIT_LTOD__DINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - SPLIT_LTOD__DINT := SPLIT_TOD__DINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__DINT := SPLIT_TOD__DINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for UDINT *) FUNCTION SPLIT_LTOD__UDINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - SPLIT_LTOD__UDINT := SPLIT_TOD__UDINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__UDINT := SPLIT_TOD__UDINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for LINT *) FUNCTION SPLIT_LTOD__LINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - SPLIT_LTOD__LINT := SPLIT_TOD__LINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__LINT := SPLIT_TOD__LINT(in, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LTOD for ULINT *) FUNCTION SPLIT_LTOD__ULINT : INT VAR_INPUT - in : LTOD; + in : LTOD; END_VAR VAR_OUTPUT - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - SPLIT_LTOD__ULINT := SPLIT_TOD__ULINT(in, hour, minute, second, millisecond); + SPLIT_LTOD__ULINT := SPLIT_TOD__ULINT(in, hour, minute, second, millisecond); END_FUNCTION (******************** @@ -660,16 +660,16 @@ END_FUNCTION ******************** *) FUNCTION SPLIT_DT < T : ANY_INT > : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -677,16 +677,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__INT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR END_FUNCTION @@ -694,16 +694,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__UINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR END_FUNCTION @@ -711,16 +711,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__DINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR END_FUNCTION @@ -728,16 +728,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__UDINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR END_FUNCTION @@ -745,16 +745,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__LINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR END_FUNCTION @@ -762,16 +762,16 @@ END_FUNCTION {external} FUNCTION SPLIT_DT__ULINT : INT VAR_INPUT - in : DT; + in : DT; END_VAR VAR_OUTPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR END_FUNCTION @@ -782,16 +782,16 @@ END_FUNCTION ******************** *) FUNCTION SPLIT_LDT < T : ANY_INT > : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : T; - month : T; - day : T; - hour : T; - minute : T; - second : T; - millisecond : T; + year : T; + month : T; + day : T; + hour : T; + minute : T; + second : T; + millisecond : T; END_VAR END_FUNCTION @@ -799,108 +799,108 @@ END_FUNCTION {external} FUNCTION SPLIT_LDT__INT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : INT; - month : INT; - day : INT; - hour : INT; - minute : INT; - second : INT; - millisecond : INT; + year : INT; + month : INT; + day : INT; + hour : INT; + minute : INT; + second : INT; + millisecond : INT; END_VAR - SPLIT_LDT__INT := SPLIT_DT__INT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__INT := SPLIT_DT__INT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for UINT *) {external} FUNCTION SPLIT_LDT__UINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : UINT; - month : UINT; - day : UINT; - hour : UINT; - minute : UINT; - second : UINT; - millisecond : UINT; + year : UINT; + month : UINT; + day : UINT; + hour : UINT; + minute : UINT; + second : UINT; + millisecond : UINT; END_VAR - SPLIT_LDT__UINT := SPLIT_DT__UINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__UINT := SPLIT_DT__UINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for DINT *) {external} FUNCTION SPLIT_LDT__DINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : DINT; - month : DINT; - day : DINT; - hour : DINT; - minute : DINT; - second : DINT; - millisecond : DINT; + year : DINT; + month : DINT; + day : DINT; + hour : DINT; + minute : DINT; + second : DINT; + millisecond : DINT; END_VAR - SPLIT_LDT__DINT := SPLIT_DT__DINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__DINT := SPLIT_DT__DINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for UDINT *) {external} FUNCTION SPLIT_LDT__UDINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : UDINT; - month : UDINT; - day : UDINT; - hour : UDINT; - minute : UDINT; - second : UDINT; - millisecond : UDINT; + year : UDINT; + month : UDINT; + day : UDINT; + hour : UDINT; + minute : UDINT; + second : UDINT; + millisecond : UDINT; END_VAR - SPLIT_LDT__UDINT := SPLIT_DT__UDINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__UDINT := SPLIT_DT__UDINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for LINT *) {external} FUNCTION SPLIT_LDT__LINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : LINT; - month : LINT; - day : LINT; - hour : LINT; - minute : LINT; - second : LINT; - millisecond : LINT; + year : LINT; + month : LINT; + day : LINT; + hour : LINT; + minute : LINT; + second : LINT; + millisecond : LINT; END_VAR - SPLIT_LDT__LINT := SPLIT_DT__LINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__LINT := SPLIT_DT__LINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (* Specialized implementation of SPLIT_LDT for ULINT *) {external} FUNCTION SPLIT_LDT__ULINT : INT VAR_INPUT - in : LDT; + in : LDT; END_VAR VAR_OUTPUT - year : ULINT; - month : ULINT; - day : ULINT; - hour : ULINT; - minute : ULINT; - second : ULINT; - millisecond : ULINT; + year : ULINT; + month : ULINT; + day : ULINT; + hour : ULINT; + minute : ULINT; + second : ULINT; + millisecond : ULINT; END_VAR - SPLIT_LDT__ULINT := SPLIT_DT__ULINT(in, year, month, day, hour, minute, second, millisecond); + SPLIT_LDT__ULINT := SPLIT_DT__ULINT(in, year, month, day, hour, minute, second, millisecond); END_FUNCTION (******************** @@ -912,7 +912,7 @@ END_FUNCTION {external} FUNCTION DAY_OF_WEEK : SINT VAR_INPUT - in : DATE; + in : DATE; END_VAR END_FUNCTION (* ************************* * @@ -925,8 +925,8 @@ END_FUNCTION (* ************************* {external} FUNCTION SHL < T : ANY_BIT > : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION @@ -944,8 +944,8 @@ END_FUNCTION {external} FUNCTION SHR < T : ANY_BIT > : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION @@ -961,8 +961,8 @@ END_FUNCTION {external} FUNCTION ROL < T : ANY_BIT > : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION @@ -978,8 +978,8 @@ END_FUNCTION {external} FUNCTION ROR < T : ANY_BIT > : T VAR_INPUT - IN : T; - n : UDINT; + IN : T; + n : UDINT; END_VAR END_FUNCTION @@ -990,9 +990,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_DWORD : DWORD VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_DWORD := in; + LWORD_TO_DWORD := in; END_FUNCTION (******************** @@ -1002,9 +1002,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_WORD : WORD VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_WORD := in; + LWORD_TO_WORD := in; END_FUNCTION (******************** @@ -1014,9 +1014,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_BYTE : BYTE VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_BYTE := in; + LWORD_TO_BYTE := in; END_FUNCTION (******************** @@ -1026,9 +1026,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_BOOL : BOOL VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_BOOL := in.0; + LWORD_TO_BOOL := in.0; END_FUNCTION (******************** @@ -1038,9 +1038,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_LWORD : LWORD VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_LWORD := in; + DWORD_TO_LWORD := in; END_FUNCTION (******************** @@ -1050,9 +1050,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_WORD : WORD VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_WORD := in; + DWORD_TO_WORD := in; END_FUNCTION (******************** @@ -1062,9 +1062,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_BYTE : BYTE VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_BYTE := in; + DWORD_TO_BYTE := in; END_FUNCTION (******************** @@ -1074,9 +1074,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_BOOL : BOOL VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_BOOL := in.0; + DWORD_TO_BOOL := in.0; END_FUNCTION (******************** @@ -1086,9 +1086,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_LWORD : LWORD VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_LWORD := in; + WORD_TO_LWORD := in; END_FUNCTION (******************** @@ -1098,9 +1098,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_DWORD : DWORD VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_DWORD := in; + WORD_TO_DWORD := in; END_FUNCTION (******************** @@ -1110,9 +1110,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_BYTE : BYTE VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_BYTE := in; + WORD_TO_BYTE := in; END_FUNCTION (******************** @@ -1122,9 +1122,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_BOOL : BOOL VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_BOOL := in.0; + WORD_TO_BOOL := in.0; END_FUNCTION (******************** @@ -1134,9 +1134,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_LWORD : LWORD VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_LWORD := in; + BYTE_TO_LWORD := in; END_FUNCTION (******************** @@ -1146,9 +1146,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_DWORD : DWORD VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_DWORD := in; + BYTE_TO_DWORD := in; END_FUNCTION (******************** @@ -1158,9 +1158,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_WORD : WORD VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_WORD := in; + BYTE_TO_WORD := in; END_FUNCTION (******************** @@ -1170,9 +1170,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_BOOL : BOOL VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_BOOL := in.0; + BYTE_TO_BOOL := in.0; END_FUNCTION (******************** @@ -1182,13 +1182,13 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_CHAR : CHAR VAR_INPUT - in : BYTE; + in : BYTE; END_VAR VAR - ptr : REF_TO CHAR; + ptr : REF_TO CHAR; END_VAR - ptr := ∈ - BYTE_TO_CHAR := ptr^; + ptr := ∈ + BYTE_TO_CHAR := ptr^; END_FUNCTION (******************** @@ -1198,13 +1198,13 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_LWORD : LWORD VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_LWORD := 1; - ELSE - BOOL_TO_LWORD := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_LWORD := 1; + ELSE + BOOL_TO_LWORD := 0; + END_IF; END_FUNCTION (******************** @@ -1214,13 +1214,13 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_DWORD : DWORD VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_DWORD := 1; - ELSE - BOOL_TO_DWORD := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_DWORD := 1; + ELSE + BOOL_TO_DWORD := 0; + END_IF; END_FUNCTION (******************** @@ -1230,13 +1230,13 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_WORD : WORD VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_WORD := 1; - ELSE - BOOL_TO_WORD := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_WORD := 1; + ELSE + BOOL_TO_WORD := 0; + END_IF; END_FUNCTION (******************** @@ -1246,13 +1246,13 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_BYTE : BYTE VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - IF in <> 0 THEN - BOOL_TO_BYTE := 1; - ELSE - BOOL_TO_BYTE := 0; - END_IF; + IF in <> 0 THEN + BOOL_TO_BYTE := 1; + ELSE + BOOL_TO_BYTE := 0; + END_IF; END_FUNCTION (******************** @@ -1262,13 +1262,13 @@ END_FUNCTION ******************** *) FUNCTION CHAR_TO_BYTE : BYTE VAR_INPUT - in : CHAR; + in : CHAR; END_VAR VAR - ptr : REF_TO BYTE; + ptr : REF_TO BYTE; END_VAR - ptr := ∈ - CHAR_TO_BYTE := ptr^; + ptr := ∈ + CHAR_TO_BYTE := ptr^; END_FUNCTION (******************** @@ -1278,9 +1278,9 @@ END_FUNCTION ******************** *) FUNCTION CHAR_TO_WORD : WORD VAR_INPUT - in : CHAR; + in : CHAR; END_VAR - CHAR_TO_WORD := CHAR_TO_BYTE(in); + CHAR_TO_WORD := CHAR_TO_BYTE(in); END_FUNCTION (******************** @@ -1290,9 +1290,9 @@ END_FUNCTION ******************** *) FUNCTION CHAR_TO_DWORD : DWORD VAR_INPUT - in : CHAR; + in : CHAR; END_VAR - CHAR_TO_DWORD := CHAR_TO_BYTE(in); + CHAR_TO_DWORD := CHAR_TO_BYTE(in); END_FUNCTION (******************** @@ -1302,9 +1302,9 @@ END_FUNCTION ******************** *) FUNCTION CHAR_TO_LWORD : LWORD VAR_INPUT - in : CHAR; + in : CHAR; END_VAR - CHAR_TO_LWORD := CHAR_TO_BYTE(in); + CHAR_TO_LWORD := CHAR_TO_BYTE(in); END_FUNCTION (******************** @@ -1314,13 +1314,13 @@ END_FUNCTION ******************** *) FUNCTION WCHAR_TO_WORD : WORD VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR VAR - ptr : REF_TO WORD; + ptr : REF_TO WORD; END_VAR - ptr := ∈ - WCHAR_TO_WORD := ptr^; + ptr := ∈ + WCHAR_TO_WORD := ptr^; END_FUNCTION (******************** @@ -1330,9 +1330,9 @@ END_FUNCTION ******************** *) FUNCTION WCHAR_TO_DWORD : DWORD VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR - WCHAR_TO_DWORD := WCHAR_TO_WORD(in); + WCHAR_TO_DWORD := WCHAR_TO_WORD(in); END_FUNCTION (******************** @@ -1342,9 +1342,9 @@ END_FUNCTION ******************** *) FUNCTION WCHAR_TO_LWORD : LWORD VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR - WCHAR_TO_LWORD := WCHAR_TO_WORD(in); + WCHAR_TO_LWORD := WCHAR_TO_WORD(in); END_FUNCTION (* ***************************************************************************** Description: Validation function for ANY_REAL Input: @@ -1356,7 +1356,7 @@ Return: {external} FUNCTION IS_VALID < T : ANY_REAL > : BOOL VAR_INPUT - IN : T; + IN : T; END_VAR END_FUNCTION @@ -1373,7 +1373,7 @@ Return: {external} FUNCTION IS_VALID_BCD < T : ANY_BIT > : BOOL VAR_INPUT - IN : T; + IN : T; END_VAR END_FUNCTION (* ***************************************************************************** Description: Bistable function, set dominant @@ -1387,11 +1387,11 @@ Return: Output is used as return {external} FUNCTION_BLOCK SR VAR_INPUT - SET1 : BOOL; - RESET : BOOL; + SET1 : BOOL; + RESET : BOOL; END_VAR VAR_OUTPUT - Q1 : BOOL; + Q1 : BOOL; END_VAR END_FUNCTION_BLOCK @@ -1407,11 +1407,11 @@ Return: Output is used as return {external} FUNCTION_BLOCK RS VAR_INPUT - SET : BOOL; - RESET1 : BOOL; + SET : BOOL; + RESET1 : BOOL; END_VAR VAR_OUTPUT - Q1 : BOOL; + Q1 : BOOL; END_VAR END_FUNCTION_BLOCK (* ******************* * @@ -1420,18 +1420,18 @@ END_FUNCTION_BLOCK (* ******************* ******************** *) FUNCTION WSTRING_TO_STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - in : WSTRING[__STRING_LENGTH]; + in : WSTRING[__STRING_LENGTH]; END_VAR - WSTRING_TO_STRING_EXT(in, WSTRING_TO_STRING); + WSTRING_TO_STRING_EXT(in, WSTRING_TO_STRING); END_FUNCTION {external} FUNCTION WSTRING_TO_STRING_EXT : DINT VAR_INPUT {ref} - in : WSTRING[__STRING_LENGTH]; + in : WSTRING[__STRING_LENGTH]; END_VAR VAR_IN_OUT - out : STRING[__STRING_LENGTH]; + out : STRING[__STRING_LENGTH]; END_VAR END_FUNCTION @@ -1442,13 +1442,13 @@ END_FUNCTION ******************** *) FUNCTION WSTRING_TO_WCHAR : WCHAR VAR_INPUT {ref} - in : WSTRING; + in : WSTRING; END_VAR VAR - ptr : REF_TO WCHAR; + ptr : REF_TO WCHAR; END_VAR - ptr := ∈ - WSTRING_TO_WCHAR := ptr^; + ptr := ∈ + WSTRING_TO_WCHAR := ptr^; END_FUNCTION (******************** @@ -1459,18 +1459,18 @@ END_FUNCTION ******************** *) FUNCTION STRING_TO_WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - in : STRING[__STRING_LENGTH]; + in : STRING[__STRING_LENGTH]; END_VAR - STRING_TO_WSTRING_EXT(in, STRING_TO_WSTRING); + STRING_TO_WSTRING_EXT(in, STRING_TO_WSTRING); END_FUNCTION {external} FUNCTION STRING_TO_WSTRING_EXT : DINT VAR_INPUT {ref} - in : STRING[__STRING_LENGTH]; + in : STRING[__STRING_LENGTH]; END_VAR VAR_IN_OUT - out : WSTRING[__STRING_LENGTH]; + out : WSTRING[__STRING_LENGTH]; END_VAR END_FUNCTION @@ -1481,13 +1481,13 @@ END_FUNCTION ******************** *) FUNCTION STRING_TO_CHAR : CHAR VAR_INPUT {ref} - in : STRING; + in : STRING; END_VAR VAR - ptr : REF_TO CHAR; + ptr : REF_TO CHAR; END_VAR - ptr := ∈ - STRING_TO_CHAR := ptr^; + ptr := ∈ + STRING_TO_CHAR := ptr^; END_FUNCTION (******************** @@ -1497,13 +1497,13 @@ END_FUNCTION ******************** *) FUNCTION WCHAR_TO_WSTRING : WSTRING VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR VAR - ptr : REF_TO WSTRING; + ptr : REF_TO WSTRING; END_VAR - ptr := ∈ - WCHAR_TO_WSTRING := ptr^; + ptr := ∈ + WCHAR_TO_WSTRING := ptr^; END_FUNCTION (******************** @@ -1514,7 +1514,7 @@ END_FUNCTION {external} FUNCTION WCHAR_TO_CHAR : CHAR VAR_INPUT - in : WCHAR; + in : WCHAR; END_VAR END_FUNCTION @@ -1525,13 +1525,13 @@ END_FUNCTION ******************** *) FUNCTION CHAR_TO_STRING : STRING VAR_INPUT - in : CHAR; + in : CHAR; END_VAR VAR - ptr : REF_TO STRING; + ptr : REF_TO STRING; END_VAR - ptr := ∈ - CHAR_TO_STRING := ptr^; + ptr := ∈ + CHAR_TO_STRING := ptr^; END_FUNCTION (******************** @@ -1542,7 +1542,7 @@ END_FUNCTION {external} FUNCTION CHAR_TO_WCHAR : WCHAR VAR_INPUT - in : CHAR; + in : CHAR; END_VAR END_FUNCTION (* ************************* * @@ -1680,12 +1680,12 @@ Return: Output variables are used for return. ***************************************************************************** *) FUNCTION_BLOCK TON VAR_INPUT - IN : BOOL; - PT : TIME; + IN : BOOL; + PT : TIME; END_VAR VAR_OUTPUT - Q : BOOL; - ET : TIME; + Q : BOOL; + ET : TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -1706,12 +1706,12 @@ Return: Output variables are used for return. ***************************************************************************** *) FUNCTION_BLOCK TON_TIME VAR_INPUT - IN : BOOL; - PT : TIME; + IN : BOOL; + PT : TIME; END_VAR VAR_OUTPUT - Q : BOOL; - ET : TIME; + Q : BOOL; + ET : TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -1732,12 +1732,12 @@ Return: Output variables are used for return. ***************************************************************************** *) FUNCTION_BLOCK TON_LTIME VAR_INPUT - IN : BOOL; - PT : LTIME; + IN : BOOL; + PT : LTIME; END_VAR VAR_OUTPUT - Q : BOOL; - ET : TIME; + Q : BOOL; + ET : TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -1758,12 +1758,12 @@ Return: Output variables are used for return. ***************************************************************************** *) FUNCTION_BLOCK TOF VAR_INPUT - IN : BOOL; - PT : TIME; + IN : BOOL; + PT : TIME; END_VAR VAR_OUTPUT - Q : BOOL; - ET : TIME; + Q : BOOL; + ET : TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -1784,12 +1784,12 @@ Return: Output variables are used for return. ***************************************************************************** *) FUNCTION_BLOCK TOF_TIME VAR_INPUT - IN : BOOL; - PT : TIME; + IN : BOOL; + PT : TIME; END_VAR VAR_OUTPUT - Q : BOOL; - ET : TIME; + Q : BOOL; + ET : TIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -1810,12 +1810,12 @@ Return: Output variables are used for return. ***************************************************************************** *) FUNCTION_BLOCK TOF_LTIME VAR_INPUT - IN : BOOL; - PT : LTIME; + IN : BOOL; + PT : LTIME; END_VAR VAR_OUTPUT - Q : BOOL; - ET : LTIME; + Q : BOOL; + ET : LTIME; END_VAR VAR __signal__ : BOOL; (* Value representing the internal signal *) @@ -1829,7 +1829,7 @@ END_FUNCTION_BLOCK (* ******************* {external} FUNCTION DATE_AND_TIME_TO_DATE : DATE VAR_INPUT - in : DT; + in : DT; END_VAR END_FUNCTION @@ -1841,7 +1841,7 @@ END_FUNCTION {external} FUNCTION DATE_AND_TIME_TO_TIME_OF_DAY : TOD VAR_INPUT - in : DT; + in : DT; END_VAR END_FUNCTION @@ -1852,9 +1852,9 @@ END_FUNCTION ******************** *) FUNCTION LTIME_TO_TIME : TIME VAR_INPUT - in : LTIME; + in : LTIME; END_VAR - LTIME_TO_TIME := in; + LTIME_TO_TIME := in; END_FUNCTION (******************** @@ -1864,9 +1864,9 @@ END_FUNCTION ******************** *) FUNCTION TIME_TO_LTIME : LTIME VAR_INPUT - in : TIME; + in : TIME; END_VAR - TIME_TO_LTIME := in; + TIME_TO_LTIME := in; END_FUNCTION (******************** @@ -1876,9 +1876,9 @@ END_FUNCTION ******************** *) FUNCTION LDT_TO_DT : DT VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_DT := in; + LDT_TO_DT := in; END_FUNCTION (******************** @@ -1888,9 +1888,9 @@ END_FUNCTION ******************** *) FUNCTION LDT_TO_DATE : DATE VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_DATE := DATE_AND_TIME_TO_DATE(in); + LDT_TO_DATE := DATE_AND_TIME_TO_DATE(in); END_FUNCTION (******************** @@ -1900,9 +1900,9 @@ END_FUNCTION ******************** *) FUNCTION LDT_TO_LTOD : LTOD VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + LDT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -1912,9 +1912,9 @@ END_FUNCTION ******************** *) FUNCTION LDT_TO_TOD : TOD VAR_INPUT - in : LDT; + in : LDT; END_VAR - LDT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + LDT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -1924,9 +1924,9 @@ END_FUNCTION ******************** *) FUNCTION DT_TO_LDT : LDT VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_LDT := in; + DT_TO_LDT := in; END_FUNCTION (******************** @@ -1936,9 +1936,9 @@ END_FUNCTION ******************** *) FUNCTION DT_TO_DATE : DATE VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_DATE := DATE_AND_TIME_TO_DATE(in); + DT_TO_DATE := DATE_AND_TIME_TO_DATE(in); END_FUNCTION (******************** @@ -1948,9 +1948,9 @@ END_FUNCTION ******************** *) FUNCTION DT_TO_LTOD : LTOD VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + DT_TO_LTOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -1960,9 +1960,9 @@ END_FUNCTION ******************** *) FUNCTION DT_TO_TOD : TOD VAR_INPUT - in : DT; + in : DT; END_VAR - DT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); + DT_TO_TOD := DATE_AND_TIME_TO_TIME_OF_DAY(in); END_FUNCTION (******************** @@ -1972,9 +1972,9 @@ END_FUNCTION ******************** *) FUNCTION LTOD_TO_TOD : TOD VAR_INPUT - in : LTOD; + in : LTOD; END_VAR - LTOD_TO_TOD := in; + LTOD_TO_TOD := in; END_FUNCTION (******************** @@ -1984,9 +1984,9 @@ END_FUNCTION ******************** *) FUNCTION TOD_TO_LTOD : LTOD VAR_INPUT - in : TOD; + in : TOD; END_VAR - TOD_TO_LTOD := in; + TOD_TO_LTOD := in; END_FUNCTION (* ******************* * * This operator returns the value of adding up the operands. @@ -1994,18 +1994,18 @@ END_FUNCTION (* ******************* ******************** *) FUNCTION ADD < T1 : ANY, T2 : ANY > : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION (* Specialized implementation of ADD for TIME *) FUNCTION ADD__TIME__TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR - ADD__TIME__TIME := ADD_TIME(IN1, IN2); + ADD__TIME__TIME := ADD_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2016,8 +2016,8 @@ END_FUNCTION {external} FUNCTION ADD_TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR END_FUNCTION @@ -2028,19 +2028,19 @@ END_FUNCTION ******************** *) FUNCTION ADD_LTIME : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : LTIME; + IN1 : LTIME; + IN2 : LTIME; END_VAR - ADD_LTIME := ADD_TIME(IN1, IN2); + ADD_LTIME := ADD_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of ADD for TOD *) FUNCTION ADD__TIME_OF_DAY__TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR - ADD__TIME_OF_DAY__TIME := ADD_TOD_TIME(IN1, IN2); + ADD__TIME_OF_DAY__TIME := ADD_TOD_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2052,8 +2052,8 @@ END_FUNCTION {external} FUNCTION ADD_TOD_TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR END_FUNCTION @@ -2065,19 +2065,19 @@ END_FUNCTION ******************** *) FUNCTION ADD_LTOD_LTIME : LTOD VAR_INPUT - IN1 : LTOD; - IN2 : LTIME; + IN1 : LTOD; + IN2 : LTIME; END_VAR - ADD_LTOD_LTIME := ADD_TOD_TIME(IN1, IN2); + ADD_LTOD_LTIME := ADD_TOD_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of ADD for DT *) FUNCTION ADD__DATE_AND_TIME__TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR - ADD__DATE_AND_TIME__TIME := ADD_DT_TIME(IN1, IN2); + ADD__DATE_AND_TIME__TIME := ADD_DT_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2089,8 +2089,8 @@ END_FUNCTION {external} FUNCTION ADD_DT_TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR END_FUNCTION @@ -2102,10 +2102,10 @@ END_FUNCTION ******************** *) FUNCTION ADD_LDT_LTIME : LDT VAR_INPUT - IN1 : LDT; - IN2 : LTIME; + IN1 : LDT; + IN2 : LTIME; END_VAR - ADD_LDT_LTIME := ADD_DT_TIME(IN1, IN2); + ADD_LDT_LTIME := ADD_DT_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2115,18 +2115,18 @@ END_FUNCTION ******************** *) FUNCTION SUB < T1 : ANY, T2 : ANY > : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION (* Specialized implementation of SUB for TIME *) FUNCTION SUB__TIME__TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR - SUB__TIME__TIME := SUB_TIME(IN1, IN2); + SUB__TIME__TIME := SUB_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2137,8 +2137,8 @@ END_FUNCTION {external} FUNCTION SUB_TIME : TIME VAR_INPUT - IN1 : TIME; - IN2 : TIME; + IN1 : TIME; + IN2 : TIME; END_VAR END_FUNCTION @@ -2149,19 +2149,19 @@ END_FUNCTION ******************** *) FUNCTION SUB_LTIME : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : LTIME; + IN1 : LTIME; + IN2 : LTIME; END_VAR - SUB_LTIME := SUB_TIME(IN1, IN2); + SUB_LTIME := SUB_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for DATE *) FUNCTION SUB__DATE__DATE : TIME VAR_INPUT - IN1 : DATE; - IN2 : DATE; + IN1 : DATE; + IN2 : DATE; END_VAR - SUB__DATE__DATE := SUB_DATE_DATE(IN1, IN2); + SUB__DATE__DATE := SUB_DATE_DATE(IN1, IN2); END_FUNCTION (******************** @@ -2173,8 +2173,8 @@ END_FUNCTION {external} FUNCTION SUB_DATE_DATE : TIME VAR_INPUT - IN1 : DATE; - IN2 : DATE; + IN1 : DATE; + IN2 : DATE; END_VAR END_FUNCTION @@ -2186,19 +2186,19 @@ END_FUNCTION ******************** *) FUNCTION SUB_LDATE_LDATE : LTIME VAR_INPUT - IN1 : LDATE; - IN2 : LDATE; + IN1 : LDATE; + IN2 : LDATE; END_VAR - SUB_LDATE_LDATE := SUB_DATE_DATE(IN1, IN2); + SUB_LDATE_LDATE := SUB_DATE_DATE(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for TOD and TIME *) FUNCTION SUB__TIME_OF_DAY__TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR - SUB__TIME_OF_DAY__TIME := SUB_TOD_TIME(IN1, IN2); + SUB__TIME_OF_DAY__TIME := SUB_TOD_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2210,8 +2210,8 @@ END_FUNCTION {external} FUNCTION SUB_TOD_TIME : TOD VAR_INPUT - IN1 : TOD; - IN2 : TIME; + IN1 : TOD; + IN2 : TIME; END_VAR END_FUNCTION @@ -2223,19 +2223,19 @@ END_FUNCTION ******************** *) FUNCTION SUB_LTOD_LTIME : LTOD VAR_INPUT - IN1 : LTOD; - IN2 : LTIME; + IN1 : LTOD; + IN2 : LTIME; END_VAR - SUB_LTOD_LTIME := SUB_TOD_TIME(IN1, IN2); + SUB_LTOD_LTIME := SUB_TOD_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for TOD *) FUNCTION SUB__TIME_OF_DAY__TIME_OF_DAY : TIME VAR_INPUT - IN1 : TOD; - IN2 : TOD; + IN1 : TOD; + IN2 : TOD; END_VAR - SUB__TIME_OF_DAY__TIME_OF_DAY := SUB_TOD_TOD(IN1, IN2); + SUB__TIME_OF_DAY__TIME_OF_DAY := SUB_TOD_TOD(IN1, IN2); END_FUNCTION (******************** @@ -2247,8 +2247,8 @@ END_FUNCTION {external} FUNCTION SUB_TOD_TOD : TIME VAR_INPUT - IN1 : TOD; - IN2 : TOD; + IN1 : TOD; + IN2 : TOD; END_VAR END_FUNCTION @@ -2260,19 +2260,19 @@ END_FUNCTION ******************** *) FUNCTION SUB_LTOD_LTOD : LTIME VAR_INPUT - IN1 : LTOD; - IN2 : LTOD; + IN1 : LTOD; + IN2 : LTOD; END_VAR - SUB_LTOD_LTOD := SUB_TOD_TOD(IN1, IN2); + SUB_LTOD_LTOD := SUB_TOD_TOD(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for DT and TIME *) FUNCTION SUB__DATE_AND_TIME__TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR - SUB__DATE_AND_TIME__TIME := SUB_DT_TIME(IN1, IN2); + SUB__DATE_AND_TIME__TIME := SUB_DT_TIME(IN1, IN2); END_FUNCTION (******************** @@ -2284,8 +2284,8 @@ END_FUNCTION {external} FUNCTION SUB_DT_TIME : DT VAR_INPUT - IN1 : DT; - IN2 : TIME; + IN1 : DT; + IN2 : TIME; END_VAR END_FUNCTION @@ -2297,19 +2297,19 @@ END_FUNCTION ******************** *) FUNCTION SUB_LDT_LTIME : LDT VAR_INPUT - IN1 : LDT; - IN2 : LTIME; + IN1 : LDT; + IN2 : LTIME; END_VAR - SUB_LDT_LTIME := SUB_DT_TIME(IN1, IN2); + SUB_LDT_LTIME := SUB_DT_TIME(IN1, IN2); END_FUNCTION (* Specialized implementation of SUB for DT *) FUNCTION SUB__DATE_AND_TIME__DATE_AND_TIME : TIME VAR_INPUT - IN1 : DT; - IN2 : DT; + IN1 : DT; + IN2 : DT; END_VAR - SUB__DATE_AND_TIME__DATE_AND_TIME := SUB_DT_DT(IN1, IN2); + SUB__DATE_AND_TIME__DATE_AND_TIME := SUB_DT_DT(IN1, IN2); END_FUNCTION (******************** @@ -2321,8 +2321,8 @@ END_FUNCTION {external} FUNCTION SUB_DT_DT : TIME VAR_INPUT - IN1 : DT; - IN2 : DT; + IN1 : DT; + IN2 : DT; END_VAR END_FUNCTION @@ -2334,10 +2334,10 @@ END_FUNCTION ******************** *) FUNCTION SUB_LDT_LDT : LTIME VAR_INPUT - IN1 : LDT; - IN2 : LDT; + IN1 : LDT; + IN2 : LDT; END_VAR - SUB_LDT_LDT := SUB_DT_DT(IN1, IN2); + SUB_LDT_LDT := SUB_DT_DT(IN1, IN2); END_FUNCTION (******************** @@ -2347,8 +2347,8 @@ END_FUNCTION ******************** *) FUNCTION MUL < T1 : ANY, T2 : ANY > : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION @@ -2359,8 +2359,8 @@ END_FUNCTION ******************** *) FUNCTION MUL_TIME < T : ANY_NUM > : TIME VAR_INPUT - IN1 : TIME; - IN2 : T; + IN1 : TIME; + IN2 : T; END_VAR END_FUNCTION @@ -2371,8 +2371,8 @@ END_FUNCTION ******************** *) FUNCTION MUL_LTIME < T : ANY_NUM > : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : T; + IN1 : LTIME; + IN2 : T; END_VAR END_FUNCTION @@ -2383,8 +2383,8 @@ END_FUNCTION ******************** *) FUNCTION DIV < T1 : ANY, T2 : ANY > : T1 VAR_INPUT - IN1 : T1; - IN2 : T2; + IN1 : T1; + IN2 : T2; END_VAR END_FUNCTION @@ -2395,8 +2395,8 @@ END_FUNCTION ******************** *) FUNCTION DIV_TIME < T : ANY_NUM > : TIME VAR_INPUT - IN1 : TIME; - IN2 : T; + IN1 : TIME; + IN2 : T; END_VAR END_FUNCTION @@ -2407,8 +2407,8 @@ END_FUNCTION ******************** *) FUNCTION DIV_LTIME < T : ANY_NUM > : LTIME VAR_INPUT - IN1 : LTIME; - IN2 : T; + IN1 : LTIME; + IN2 : T; END_VAR END_FUNCTION (* ******************* * @@ -2417,9 +2417,9 @@ END_FUNCTION (* ******************* ******************** *) FUNCTION LREAL_TO_REAL : REAL VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_REAL := in; + LREAL_TO_REAL := in; END_FUNCTION (******************** @@ -2429,9 +2429,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_LINT : LINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_LINT := ROUND(in); + LREAL_TO_LINT := ROUND(in); END_FUNCTION (******************** @@ -2441,9 +2441,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_DINT : DINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_DINT := ROUND(in); + LREAL_TO_DINT := ROUND(in); END_FUNCTION (******************** @@ -2453,9 +2453,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_INT : INT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_INT := ROUND(in); + LREAL_TO_INT := ROUND(in); END_FUNCTION (******************** @@ -2465,9 +2465,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_SINT : SINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_SINT := ROUND(in); + LREAL_TO_SINT := ROUND(in); END_FUNCTION (******************** @@ -2477,9 +2477,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_ULINT : ULINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_ULINT := ROUND(in); + LREAL_TO_ULINT := ROUND(in); END_FUNCTION (******************** @@ -2489,9 +2489,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_UDINT : UDINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_UDINT := ROUND(in); + LREAL_TO_UDINT := ROUND(in); END_FUNCTION (******************** @@ -2501,9 +2501,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_UINT : UINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_UINT := ROUND(in); + LREAL_TO_UINT := ROUND(in); END_FUNCTION (******************** @@ -2513,9 +2513,9 @@ END_FUNCTION ******************** *) FUNCTION LREAL_TO_USINT : USINT VAR_INPUT - in : LREAL; + in : LREAL; END_VAR - LREAL_TO_USINT := ROUND(in); + LREAL_TO_USINT := ROUND(in); END_FUNCTION (******************** @@ -2525,9 +2525,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_LREAL : LREAL VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_LREAL := in; + REAL_TO_LREAL := in; END_FUNCTION (******************** @@ -2537,9 +2537,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_LINT : LINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_LINT := ROUND(in); + REAL_TO_LINT := ROUND(in); END_FUNCTION (******************** @@ -2549,9 +2549,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_DINT : DINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_DINT := ROUND(in); + REAL_TO_DINT := ROUND(in); END_FUNCTION (******************** @@ -2561,9 +2561,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_INT : INT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_INT := ROUND(in); + REAL_TO_INT := ROUND(in); END_FUNCTION (******************** @@ -2573,9 +2573,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_SINT : SINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_SINT := ROUND(in); + REAL_TO_SINT := ROUND(in); END_FUNCTION (******************** @@ -2585,9 +2585,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_ULINT : ULINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_ULINT := ROUND(in); + REAL_TO_ULINT := ROUND(in); END_FUNCTION (******************** @@ -2597,9 +2597,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_UDINT : UDINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_UDINT := ROUND(in); + REAL_TO_UDINT := ROUND(in); END_FUNCTION (******************** @@ -2609,9 +2609,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_UINT : UINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_UINT := ROUND(in); + REAL_TO_UINT := ROUND(in); END_FUNCTION (******************** @@ -2621,9 +2621,9 @@ END_FUNCTION ******************** *) FUNCTION REAL_TO_USINT : USINT VAR_INPUT - in : REAL; + in : REAL; END_VAR - REAL_TO_USINT := ROUND(in); + REAL_TO_USINT := ROUND(in); END_FUNCTION (******************** @@ -2633,9 +2633,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_LREAL : LREAL VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_LREAL := in; + LINT_TO_LREAL := in; END_FUNCTION (******************** @@ -2645,9 +2645,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_REAL : REAL VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_REAL := in; + LINT_TO_REAL := in; END_FUNCTION (******************** @@ -2657,9 +2657,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_DINT : DINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_DINT := in; + LINT_TO_DINT := in; END_FUNCTION (******************** @@ -2669,9 +2669,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_INT : INT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_INT := in; + LINT_TO_INT := in; END_FUNCTION (******************** @@ -2681,9 +2681,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_SINT : SINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_SINT := in; + LINT_TO_SINT := in; END_FUNCTION (******************** @@ -2693,9 +2693,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_ULINT : ULINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_ULINT := in; + LINT_TO_ULINT := in; END_FUNCTION (******************** @@ -2705,9 +2705,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_UDINT : UDINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_UDINT := in; + LINT_TO_UDINT := in; END_FUNCTION (******************** @@ -2717,9 +2717,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_UINT : UINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_UINT := in; + LINT_TO_UINT := in; END_FUNCTION (******************** @@ -2729,9 +2729,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_USINT : USINT VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_USINT := in; + LINT_TO_USINT := in; END_FUNCTION (******************** @@ -2741,9 +2741,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_LREAL : LREAL VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_LREAL := in; + DINT_TO_LREAL := in; END_FUNCTION (******************** @@ -2753,9 +2753,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_REAL : REAL VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_REAL := in; + DINT_TO_REAL := in; END_FUNCTION (******************** @@ -2765,9 +2765,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_LINT : LINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_LINT := in; + DINT_TO_LINT := in; END_FUNCTION (******************** @@ -2777,9 +2777,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_INT : INT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_INT := in; + DINT_TO_INT := in; END_FUNCTION (******************** @@ -2789,9 +2789,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_SINT : SINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_SINT := in; + DINT_TO_SINT := in; END_FUNCTION (******************** @@ -2801,9 +2801,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_ULINT : ULINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_ULINT := in; + DINT_TO_ULINT := in; END_FUNCTION (******************** @@ -2813,9 +2813,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_UDINT : UDINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_UDINT := in; + DINT_TO_UDINT := in; END_FUNCTION (******************** @@ -2825,9 +2825,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_UINT : UINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_UINT := in; + DINT_TO_UINT := in; END_FUNCTION (******************** @@ -2837,9 +2837,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_USINT : USINT VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_USINT := in; + DINT_TO_USINT := in; END_FUNCTION (******************** @@ -2849,9 +2849,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_LREAL : LREAL VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_LREAL := in; + INT_TO_LREAL := in; END_FUNCTION (******************** @@ -2861,9 +2861,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_REAL : REAL VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_REAL := in; + INT_TO_REAL := in; END_FUNCTION (******************** @@ -2873,9 +2873,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_LINT : LINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_LINT := in; + INT_TO_LINT := in; END_FUNCTION (******************** @@ -2885,9 +2885,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_DINT : DINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_DINT := in; + INT_TO_DINT := in; END_FUNCTION (******************** @@ -2897,9 +2897,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_SINT : SINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_SINT := in; + INT_TO_SINT := in; END_FUNCTION (******************** @@ -2909,9 +2909,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_ULINT : ULINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_ULINT := in; + INT_TO_ULINT := in; END_FUNCTION (******************** @@ -2921,9 +2921,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_UDINT : UDINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_UDINT := in; + INT_TO_UDINT := in; END_FUNCTION (******************** @@ -2933,9 +2933,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_UINT : UINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_UINT := in; + INT_TO_UINT := in; END_FUNCTION (******************** @@ -2945,9 +2945,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_USINT : USINT VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_USINT := in; + INT_TO_USINT := in; END_FUNCTION (******************** @@ -2957,9 +2957,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_LREAL : LREAL VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_LREAL := in; + SINT_TO_LREAL := in; END_FUNCTION (******************** @@ -2969,9 +2969,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_REAL : REAL VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_REAL := in; + SINT_TO_REAL := in; END_FUNCTION (******************** @@ -2981,9 +2981,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_LINT : LINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_LINT := in; + SINT_TO_LINT := in; END_FUNCTION (******************** @@ -2993,9 +2993,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_DINT : DINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_DINT := in; + SINT_TO_DINT := in; END_FUNCTION (******************** @@ -3005,9 +3005,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_INT : INT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_INT := in; + SINT_TO_INT := in; END_FUNCTION (******************** @@ -3017,9 +3017,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_ULINT : ULINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_ULINT := in; + SINT_TO_ULINT := in; END_FUNCTION (******************** @@ -3029,9 +3029,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_UDINT : UDINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_UDINT := in; + SINT_TO_UDINT := in; END_FUNCTION (******************** @@ -3041,9 +3041,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_UINT : UINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_UINT := in; + SINT_TO_UINT := in; END_FUNCTION (******************** @@ -3053,9 +3053,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_USINT : USINT VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_USINT := in; + SINT_TO_USINT := in; END_FUNCTION (******************** @@ -3065,9 +3065,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_LREAL : LREAL VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_LREAL := in; + ULINT_TO_LREAL := in; END_FUNCTION (******************** @@ -3077,9 +3077,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_REAL : REAL VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_REAL := in; + ULINT_TO_REAL := in; END_FUNCTION (******************** @@ -3089,9 +3089,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_LINT : LINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_LINT := in; + ULINT_TO_LINT := in; END_FUNCTION (******************** @@ -3101,9 +3101,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_DINT : DINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_DINT := in; + ULINT_TO_DINT := in; END_FUNCTION (******************** @@ -3113,9 +3113,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_INT : INT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_INT := in; + ULINT_TO_INT := in; END_FUNCTION (******************** @@ -3125,9 +3125,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_SINT : SINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_SINT := in; + ULINT_TO_SINT := in; END_FUNCTION (******************** @@ -3137,9 +3137,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_UDINT : UDINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_UDINT := in; + ULINT_TO_UDINT := in; END_FUNCTION (******************** @@ -3149,9 +3149,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_UINT : UINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_UINT := in; + ULINT_TO_UINT := in; END_FUNCTION (******************** @@ -3161,9 +3161,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_USINT : USINT VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_USINT := in; + ULINT_TO_USINT := in; END_FUNCTION (******************** @@ -3173,9 +3173,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_LREAL : LREAL VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_LREAL := in; + UDINT_TO_LREAL := in; END_FUNCTION (******************** @@ -3185,9 +3185,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_REAL : REAL VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_REAL := in; + UDINT_TO_REAL := in; END_FUNCTION (******************** @@ -3197,9 +3197,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_LINT : LINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_LINT := in; + UDINT_TO_LINT := in; END_FUNCTION (******************** @@ -3209,9 +3209,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_DINT : DINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_DINT := in; + UDINT_TO_DINT := in; END_FUNCTION (******************** @@ -3221,9 +3221,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_INT : INT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_INT := in; + UDINT_TO_INT := in; END_FUNCTION (******************** @@ -3233,9 +3233,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_SINT : SINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_SINT := in; + UDINT_TO_SINT := in; END_FUNCTION (******************** @@ -3245,9 +3245,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_ULINT : ULINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_ULINT := in; + UDINT_TO_ULINT := in; END_FUNCTION (******************** @@ -3257,9 +3257,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_UINT : UINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_UINT := in; + UDINT_TO_UINT := in; END_FUNCTION (******************** @@ -3269,9 +3269,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_USINT : USINT VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_USINT := in; + UDINT_TO_USINT := in; END_FUNCTION (******************** @@ -3281,9 +3281,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_LREAL : LREAL VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_LREAL := in; + UINT_TO_LREAL := in; END_FUNCTION (******************** @@ -3293,9 +3293,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_REAL : REAL VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_REAL := in; + UINT_TO_REAL := in; END_FUNCTION (******************** @@ -3305,9 +3305,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_LINT : LINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_LINT := in; + UINT_TO_LINT := in; END_FUNCTION (******************** @@ -3317,9 +3317,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_DINT : DINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_DINT := in; + UINT_TO_DINT := in; END_FUNCTION (******************** @@ -3329,9 +3329,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_INT : INT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_INT := in; + UINT_TO_INT := in; END_FUNCTION (******************** @@ -3341,9 +3341,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_SINT : SINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_SINT := in; + UINT_TO_SINT := in; END_FUNCTION (******************** @@ -3353,9 +3353,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_ULINT : ULINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_ULINT := in; + UINT_TO_ULINT := in; END_FUNCTION (******************** @@ -3365,9 +3365,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_UDINT : UDINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_UDINT := in; + UINT_TO_UDINT := in; END_FUNCTION (******************** @@ -3377,9 +3377,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_USINT : USINT VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_USINT := in; + UINT_TO_USINT := in; END_FUNCTION (******************** @@ -3389,9 +3389,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_LREAL : LREAL VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_LREAL := in; + USINT_TO_LREAL := in; END_FUNCTION (******************** @@ -3401,9 +3401,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_REAL : REAL VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_REAL := in; + USINT_TO_REAL := in; END_FUNCTION (******************** @@ -3413,9 +3413,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_LINT : LINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_LINT := in; + USINT_TO_LINT := in; END_FUNCTION (******************** @@ -3425,9 +3425,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_DINT : DINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_DINT := in; + USINT_TO_DINT := in; END_FUNCTION (******************** @@ -3437,9 +3437,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_INT : INT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_INT := in; + USINT_TO_INT := in; END_FUNCTION (******************** @@ -3449,9 +3449,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_SINT : SINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_SINT := in; + USINT_TO_SINT := in; END_FUNCTION (******************** @@ -3461,9 +3461,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_ULINT : ULINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_ULINT := in; + USINT_TO_ULINT := in; END_FUNCTION (******************** @@ -3473,9 +3473,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_UDINT : UDINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_UDINT := in; + USINT_TO_UDINT := in; END_FUNCTION (******************** @@ -3485,9 +3485,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_UINT : UINT VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_UINT := in; + USINT_TO_UINT := in; END_FUNCTION (* ***************************************************************************** Description: Rising Edge detection Input: @@ -3499,13 +3499,13 @@ Return: Output variable are used for return. {external} FUNCTION_BLOCK R_TRIG VAR_INPUT - CLK : BOOL; + CLK : BOOL; END_VAR VAR_OUTPUT - Q : BOOL; + Q : BOOL; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -3520,13 +3520,13 @@ Return: Output variable is used for return. {external} FUNCTION_BLOCK F_TRIG VAR_INPUT - CLK : BOOL; + CLK : BOOL; END_VAR VAR_OUTPUT - Q : BOOL; + Q : BOOL; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK (* ***************************************************************************** * @@ -4639,16 +4639,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU VAR_INPUT - CU : BOOL; - R : BOOL; - PV : INT; + CU : BOOL; + R : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4666,16 +4666,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_INT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : INT; + CU : BOOL; + R : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4693,16 +4693,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_DINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : DINT; + CU : BOOL; + R : BOOL; + PV : DINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : DINT; + Q : BOOL; + CV : DINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4720,16 +4720,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_UDINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : UDINT; + CU : BOOL; + R : BOOL; + PV : UDINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : UDINT; + Q : BOOL; + CV : UDINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4747,16 +4747,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_LINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : LINT; + CU : BOOL; + R : BOOL; + PV : LINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : LINT; + Q : BOOL; + CV : LINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4774,16 +4774,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTU_ULINT VAR_INPUT - CU : BOOL; - R : BOOL; - PV : ULINT; + CU : BOOL; + R : BOOL; + PV : ULINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : ULINT; + Q : BOOL; + CV : ULINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4801,16 +4801,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : INT; + CD : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4828,16 +4828,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_INT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : INT; + CD : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : INT; + Q : BOOL; + CV : INT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4855,16 +4855,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_DINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : DINT; + CD : BOOL; + LD : BOOL; + PV : DINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : DINT; + Q : BOOL; + CV : DINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4882,16 +4882,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_UDINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : UDINT; + CD : BOOL; + LD : BOOL; + PV : UDINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : UDINT; + Q : BOOL; + CV : UDINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4909,16 +4909,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_LINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : LINT; + CD : BOOL; + LD : BOOL; + PV : LINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : LINT; + Q : BOOL; + CV : LINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4936,16 +4936,16 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTD_ULINT VAR_INPUT - CD : BOOL; - LD : BOOL; - PV : ULINT; + CD : BOOL; + LD : BOOL; + PV : ULINT; END_VAR VAR_OUTPUT - Q : BOOL; - CV : ULINT; + Q : BOOL; + CV : ULINT; END_VAR VAR - M : BOOL; + M : BOOL; END_VAR END_FUNCTION_BLOCK @@ -4966,20 +4966,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : INT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : INT; + QU : BOOL; + QD : BOOL; + CV : INT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -5000,20 +5000,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_INT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : INT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : INT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : INT; + QU : BOOL; + QD : BOOL; + CV : INT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -5034,20 +5034,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_DINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : DINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : DINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : DINT; + QU : BOOL; + QD : BOOL; + CV : DINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -5068,20 +5068,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_UDINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : UDINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : UDINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : UDINT; + QU : BOOL; + QD : BOOL; + CV : UDINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -5102,20 +5102,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_LINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : LINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : LINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : LINT; + QU : BOOL; + QD : BOOL; + CV : LINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK @@ -5136,20 +5136,20 @@ Return: Output is used as return value {external} FUNCTION_BLOCK CTUD_ULINT VAR_INPUT - CU : BOOL; - CD : BOOL; - R : BOOL; - LD : BOOL; - PV : ULINT; + CU : BOOL; + CD : BOOL; + R : BOOL; + LD : BOOL; + PV : ULINT; END_VAR VAR_OUTPUT - QU : BOOL; - QD : BOOL; - CV : ULINT; + QU : BOOL; + QD : BOOL; + CV : ULINT; END_VAR VAR - MU : BOOL; - MD : BOOL; + MU : BOOL; + MD : BOOL; END_VAR END_FUNCTION_BLOCK (* ******************* * @@ -5159,7 +5159,7 @@ END_FUNCTION_BLOCK (* ******************* {external} FUNCTION TO_BIG_ENDIAN < T : ANY > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -5171,7 +5171,7 @@ END_FUNCTION {external} FUNCTION TO_LITTLE_ENDIAN < T : ANY > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -5183,7 +5183,7 @@ END_FUNCTION {external} FUNCTION FROM_BIG_ENDIAN < T : ANY > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -5195,7 +5195,7 @@ END_FUNCTION {external} FUNCTION FROM_LITTLE_ENDIAN < T : ANY > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -5207,7 +5207,7 @@ END_FUNCTION {external} FUNCTION LWORD_TO_LREAL : LREAL VAR_INPUT - in : LWORD; + in : LWORD; END_VAR END_FUNCTION @@ -5218,9 +5218,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_LINT : LINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_LINT := in; + LWORD_TO_LINT := in; END_FUNCTION (******************** @@ -5230,9 +5230,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_DINT : DINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_DINT := in; + LWORD_TO_DINT := in; END_FUNCTION (******************** @@ -5242,9 +5242,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_INT : INT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_INT := in; + LWORD_TO_INT := in; END_FUNCTION (******************** @@ -5254,9 +5254,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_SINT : SINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_SINT := in; + LWORD_TO_SINT := in; END_FUNCTION (******************** @@ -5266,9 +5266,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_ULINT : ULINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_ULINT := in; + LWORD_TO_ULINT := in; END_FUNCTION (******************** @@ -5278,9 +5278,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_UDINT : UDINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_UDINT := in; + LWORD_TO_UDINT := in; END_FUNCTION (******************** @@ -5290,9 +5290,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_UINT : UINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_UINT := in; + LWORD_TO_UINT := in; END_FUNCTION (******************** @@ -5302,9 +5302,9 @@ END_FUNCTION ******************** *) FUNCTION LWORD_TO_USINT : USINT VAR_INPUT - in : LWORD; + in : LWORD; END_VAR - LWORD_TO_USINT := in; + LWORD_TO_USINT := in; END_FUNCTION (******************** @@ -5315,7 +5315,7 @@ END_FUNCTION {external} FUNCTION DWORD_TO_REAL : REAL VAR_INPUT - in : DWORD; + in : DWORD; END_VAR END_FUNCTION @@ -5326,9 +5326,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_LINT : LINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_LINT := in; + DWORD_TO_LINT := in; END_FUNCTION (******************** @@ -5338,9 +5338,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_DINT : DINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_DINT := in; + DWORD_TO_DINT := in; END_FUNCTION (******************** @@ -5350,9 +5350,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_INT : INT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_INT := in; + DWORD_TO_INT := in; END_FUNCTION (******************** @@ -5362,9 +5362,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_SINT : SINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_SINT := in; + DWORD_TO_SINT := in; END_FUNCTION (******************** @@ -5374,9 +5374,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_ULINT : ULINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_ULINT := in; + DWORD_TO_ULINT := in; END_FUNCTION (******************** @@ -5386,9 +5386,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_UDINT : UDINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_UDINT := in; + DWORD_TO_UDINT := in; END_FUNCTION (******************** @@ -5398,9 +5398,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_UINT : UINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_UINT := in; + DWORD_TO_UINT := in; END_FUNCTION (******************** @@ -5410,9 +5410,9 @@ END_FUNCTION ******************** *) FUNCTION DWORD_TO_USINT : USINT VAR_INPUT - in : DWORD; + in : DWORD; END_VAR - DWORD_TO_USINT := in; + DWORD_TO_USINT := in; END_FUNCTION (******************** @@ -5422,9 +5422,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_LINT : LINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_LINT := in; + WORD_TO_LINT := in; END_FUNCTION (******************** @@ -5434,9 +5434,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_DINT : DINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_DINT := in; + WORD_TO_DINT := in; END_FUNCTION (******************** @@ -5446,9 +5446,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_INT : INT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_INT := in; + WORD_TO_INT := in; END_FUNCTION (******************** @@ -5458,9 +5458,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_SINT : SINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_SINT := in; + WORD_TO_SINT := in; END_FUNCTION (******************** @@ -5470,9 +5470,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_ULINT : ULINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_ULINT := in; + WORD_TO_ULINT := in; END_FUNCTION (******************** @@ -5482,9 +5482,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_UDINT : UDINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_UDINT := in; + WORD_TO_UDINT := in; END_FUNCTION (******************** @@ -5494,9 +5494,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_UINT : UINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_UINT := in; + WORD_TO_UINT := in; END_FUNCTION (******************** @@ -5506,9 +5506,9 @@ END_FUNCTION ******************** *) FUNCTION WORD_TO_USINT : USINT VAR_INPUT - in : WORD; + in : WORD; END_VAR - WORD_TO_USINT := in; + WORD_TO_USINT := in; END_FUNCTION (******************** @@ -5518,9 +5518,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_LINT : LINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_LINT := in; + BYTE_TO_LINT := in; END_FUNCTION (******************** @@ -5530,9 +5530,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_DINT : DINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_DINT := in; + BYTE_TO_DINT := in; END_FUNCTION (******************** @@ -5542,9 +5542,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_INT : INT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_INT := in; + BYTE_TO_INT := in; END_FUNCTION (******************** @@ -5554,9 +5554,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_SINT : SINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_SINT := in; + BYTE_TO_SINT := in; END_FUNCTION (******************** @@ -5566,9 +5566,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_ULINT : ULINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_ULINT := in; + BYTE_TO_ULINT := in; END_FUNCTION (******************** @@ -5578,9 +5578,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_UDINT : UDINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_UDINT := in; + BYTE_TO_UDINT := in; END_FUNCTION (******************** @@ -5590,9 +5590,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_UINT : UINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_UINT := in; + BYTE_TO_UINT := in; END_FUNCTION (******************** @@ -5602,9 +5602,9 @@ END_FUNCTION ******************** *) FUNCTION BYTE_TO_USINT : USINT VAR_INPUT - in : BYTE; + in : BYTE; END_VAR - BYTE_TO_USINT := in; + BYTE_TO_USINT := in; END_FUNCTION (******************** @@ -5614,9 +5614,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_LINT : LINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_LINT := in; + BOOL_TO_LINT := in; END_FUNCTION (******************** @@ -5626,9 +5626,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_DINT : DINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_DINT := in; + BOOL_TO_DINT := in; END_FUNCTION (******************** @@ -5638,9 +5638,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_INT : INT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_INT := in; + BOOL_TO_INT := in; END_FUNCTION (******************** @@ -5650,9 +5650,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_SINT : SINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_SINT := in; + BOOL_TO_SINT := in; END_FUNCTION (******************** @@ -5662,9 +5662,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_ULINT : ULINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_ULINT := in; + BOOL_TO_ULINT := in; END_FUNCTION (******************** @@ -5674,9 +5674,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_UDINT : UDINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_UDINT := in; + BOOL_TO_UDINT := in; END_FUNCTION (******************** @@ -5686,9 +5686,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_UINT : UINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_UINT := in; + BOOL_TO_UINT := in; END_FUNCTION (******************** @@ -5698,9 +5698,9 @@ END_FUNCTION ******************** *) FUNCTION BOOL_TO_USINT : USINT VAR_INPUT - in : BOOL; + in : BOOL; END_VAR - BOOL_TO_USINT := in; + BOOL_TO_USINT := in; END_FUNCTION (******************** @@ -5711,7 +5711,7 @@ END_FUNCTION {external} FUNCTION LREAL_TO_LWORD : LWORD VAR_INPUT - in : LREAL; + in : LREAL; END_VAR END_FUNCTION @@ -5723,7 +5723,7 @@ END_FUNCTION {external} FUNCTION REAL_TO_DWORD : DWORD VAR_INPUT - in : REAL; + in : REAL; END_VAR END_FUNCTION @@ -5734,9 +5734,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_LWORD : LWORD VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_LWORD := in; + LINT_TO_LWORD := in; END_FUNCTION (******************** @@ -5746,9 +5746,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_DWORD : DWORD VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_DWORD := in; + LINT_TO_DWORD := in; END_FUNCTION (******************** @@ -5758,9 +5758,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_WORD : WORD VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_WORD := in; + LINT_TO_WORD := in; END_FUNCTION (******************** @@ -5770,9 +5770,9 @@ END_FUNCTION ******************** *) FUNCTION LINT_TO_BYTE : BYTE VAR_INPUT - in : LINT; + in : LINT; END_VAR - LINT_TO_BYTE := in; + LINT_TO_BYTE := in; END_FUNCTION (******************** @@ -5782,9 +5782,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_LWORD : LWORD VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_LWORD := in; + DINT_TO_LWORD := in; END_FUNCTION (******************** @@ -5794,9 +5794,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_DWORD : DWORD VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_DWORD := in; + DINT_TO_DWORD := in; END_FUNCTION (******************** @@ -5806,9 +5806,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_WORD : WORD VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_WORD := in; + DINT_TO_WORD := in; END_FUNCTION (******************** @@ -5818,9 +5818,9 @@ END_FUNCTION ******************** *) FUNCTION DINT_TO_BYTE : BYTE VAR_INPUT - in : DINT; + in : DINT; END_VAR - DINT_TO_BYTE := in; + DINT_TO_BYTE := in; END_FUNCTION (******************** @@ -5830,9 +5830,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_LWORD : LWORD VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_LWORD := in; + INT_TO_LWORD := in; END_FUNCTION (******************** @@ -5842,9 +5842,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_DWORD : DWORD VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_DWORD := in; + INT_TO_DWORD := in; END_FUNCTION (******************** @@ -5854,9 +5854,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_WORD : WORD VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_WORD := in; + INT_TO_WORD := in; END_FUNCTION (******************** @@ -5866,9 +5866,9 @@ END_FUNCTION ******************** *) FUNCTION INT_TO_BYTE : BYTE VAR_INPUT - in : INT; + in : INT; END_VAR - INT_TO_BYTE := in; + INT_TO_BYTE := in; END_FUNCTION (******************** @@ -5878,9 +5878,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_LWORD : LWORD VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_LWORD := in; + SINT_TO_LWORD := in; END_FUNCTION (******************** @@ -5890,9 +5890,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_DWORD : DWORD VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_DWORD := in; + SINT_TO_DWORD := in; END_FUNCTION (******************** @@ -5902,9 +5902,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_WORD : WORD VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_WORD := in; + SINT_TO_WORD := in; END_FUNCTION (******************** @@ -5914,9 +5914,9 @@ END_FUNCTION ******************** *) FUNCTION SINT_TO_BYTE : BYTE VAR_INPUT - in : SINT; + in : SINT; END_VAR - SINT_TO_BYTE := in; + SINT_TO_BYTE := in; END_FUNCTION (******************** @@ -5926,9 +5926,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_LWORD : LWORD VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_LWORD := in; + ULINT_TO_LWORD := in; END_FUNCTION (******************** @@ -5938,9 +5938,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_DWORD : DWORD VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_DWORD := in; + ULINT_TO_DWORD := in; END_FUNCTION (******************** @@ -5950,9 +5950,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_WORD : WORD VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_WORD := in; + ULINT_TO_WORD := in; END_FUNCTION (******************** @@ -5962,9 +5962,9 @@ END_FUNCTION ******************** *) FUNCTION ULINT_TO_BYTE : BYTE VAR_INPUT - in : ULINT; + in : ULINT; END_VAR - ULINT_TO_BYTE := in; + ULINT_TO_BYTE := in; END_FUNCTION (******************** @@ -5974,9 +5974,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_LWORD : LWORD VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_LWORD := in; + UDINT_TO_LWORD := in; END_FUNCTION (******************** @@ -5986,9 +5986,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_DWORD : DWORD VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_DWORD := in; + UDINT_TO_DWORD := in; END_FUNCTION (******************** @@ -5998,9 +5998,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_WORD : WORD VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_WORD := in; + UDINT_TO_WORD := in; END_FUNCTION (******************** @@ -6010,9 +6010,9 @@ END_FUNCTION ******************** *) FUNCTION UDINT_TO_BYTE : BYTE VAR_INPUT - in : UDINT; + in : UDINT; END_VAR - UDINT_TO_BYTE := in; + UDINT_TO_BYTE := in; END_FUNCTION (******************** @@ -6022,9 +6022,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_LWORD : LWORD VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_LWORD := in; + UINT_TO_LWORD := in; END_FUNCTION (******************** @@ -6034,9 +6034,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_DWORD : DWORD VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_DWORD := in; + UINT_TO_DWORD := in; END_FUNCTION (******************** @@ -6046,9 +6046,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_WORD : WORD VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_WORD := in; + UINT_TO_WORD := in; END_FUNCTION (******************** @@ -6058,9 +6058,9 @@ END_FUNCTION ******************** *) FUNCTION UINT_TO_BYTE : BYTE VAR_INPUT - in : UINT; + in : UINT; END_VAR - UINT_TO_BYTE := in; + UINT_TO_BYTE := in; END_FUNCTION (******************** @@ -6070,9 +6070,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_LWORD : LWORD VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_LWORD := in; + USINT_TO_LWORD := in; END_FUNCTION (******************** @@ -6082,9 +6082,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_DWORD : DWORD VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_DWORD := in; + USINT_TO_DWORD := in; END_FUNCTION (******************** @@ -6094,9 +6094,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_WORD : WORD VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_WORD := in; + USINT_TO_WORD := in; END_FUNCTION (******************** @@ -6106,9 +6106,9 @@ END_FUNCTION ******************** *) FUNCTION USINT_TO_BYTE : BYTE VAR_INPUT - in : USINT; + in : USINT; END_VAR - USINT_TO_BYTE := in; + USINT_TO_BYTE := in; END_FUNCTIONVAR_GLOBAL CONSTANT __STRING_LENGTH : DINT := 2048; END_VAR @@ -6122,7 +6122,7 @@ Return: String length {external} FUNCTION LEN < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR END_FUNCTION @@ -6135,7 +6135,7 @@ Return: A substring consisting of the leftmost L characters of IN ***************************************************************************** *) FUNCTION LEFT < T : ANY_STRING > : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6145,7 +6145,7 @@ END_FUNCTION {external} FUNCTION LEFT_EXT < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6157,7 +6157,7 @@ END_FUNCTION FUNCTION LEFT__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6167,7 +6167,7 @@ END_FUNCTION FUNCTION LEFT__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6178,7 +6178,7 @@ END_FUNCTION {external} FUNCTION LEFT_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6191,7 +6191,7 @@ END_FUNCTION {external} FUNCTION LEFT_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6210,7 +6210,7 @@ Return: A substring consisting of the rightmost L characters of IN ***************************************************************************** *) FUNCTION RIGHT < T : ANY_STRING > : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6220,7 +6220,7 @@ END_FUNCTION {external} FUNCTION RIGHT_EXT < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6232,7 +6232,7 @@ END_FUNCTION FUNCTION RIGHT__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6242,7 +6242,7 @@ END_FUNCTION FUNCTION RIGHT__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6253,7 +6253,7 @@ END_FUNCTION {external} FUNCTION RIGHT_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6266,7 +6266,7 @@ END_FUNCTION {external} FUNCTION RIGHT_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6288,7 +6288,7 @@ Return: ***************************************************************************** *) FUNCTION MID < T : ANY_STRING > : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6299,7 +6299,7 @@ END_FUNCTION {external} FUNCTION MID_EXT < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6312,7 +6312,7 @@ END_FUNCTION FUNCTION MID__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6323,7 +6323,7 @@ END_FUNCTION FUNCTION MID__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6335,7 +6335,7 @@ END_FUNCTION {external} FUNCTION MID_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6349,7 +6349,7 @@ END_FUNCTION {external} FUNCTION MID_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6372,20 +6372,20 @@ Return: {external} FUNCTION CONCAT__STRING : STRING[2048] VAR_INPUT {ref} - args : {sized} STRING...; + args : {sized} STRING...; END_VAR END_FUNCTION {external} FUNCTION CONCAT__WSTRING : WSTRING[2048] VAR_INPUT {ref} - args : {sized} WSTRING...; + args : {sized} WSTRING...; END_VAR END_FUNCTION FUNCTION CONCAT < T : ANY_STRING > : T VAR_INPUT {ref} - args : {sized} T...; + args : {sized} T...; END_VAR END_FUNCTION @@ -6410,7 +6410,7 @@ Return: ***************************************************************************** *) FUNCTION INSERT < T : ANY_STRING > : T VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR VAR_INPUT @@ -6421,7 +6421,7 @@ END_FUNCTION {external} FUNCTION INSERT_EXT < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR VAR_INPUT @@ -6434,7 +6434,7 @@ END_FUNCTION FUNCTION INSERT__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN1 : STRING[__STRING_LENGTH]; + IN1 : STRING[__STRING_LENGTH]; IN2 : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -6445,7 +6445,7 @@ END_FUNCTION FUNCTION INSERT__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN1 : WSTRING[__STRING_LENGTH]; + IN1 : WSTRING[__STRING_LENGTH]; IN2 : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -6457,7 +6457,7 @@ END_FUNCTION {external} FUNCTION INSERT_EXT__STRING : DINT VAR_INPUT {ref} - IN1 : STRING[__STRING_LENGTH]; + IN1 : STRING[__STRING_LENGTH]; IN2 : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -6471,7 +6471,7 @@ END_FUNCTION {external} FUNCTION INSERT_EXT__WSTRING : DINT VAR_INPUT {ref} - IN1 : WSTRING[__STRING_LENGTH]; + IN1 : WSTRING[__STRING_LENGTH]; IN2 : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -6492,7 +6492,7 @@ Return: A new string with L characters deleted from P onwards ***************************************************************************** *) FUNCTION DELETE < T : ANY_STRING > : T VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6503,7 +6503,7 @@ END_FUNCTION {external} FUNCTION DELETE_EXT < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN : T; + IN : T; END_VAR VAR_INPUT L : DINT; @@ -6516,7 +6516,7 @@ END_FUNCTION FUNCTION DELETE__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6527,7 +6527,7 @@ END_FUNCTION FUNCTION DELETE__WSTRING : WSTRING[__STRING_LENGTH] VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6539,7 +6539,7 @@ END_FUNCTION {external} FUNCTION DELETE_EXT__STRING : DINT VAR_INPUT {ref} - IN : STRING[__STRING_LENGTH]; + IN : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6553,7 +6553,7 @@ END_FUNCTION {external} FUNCTION DELETE_EXT__WSTRING : DINT VAR_INPUT {ref} - IN : WSTRING[__STRING_LENGTH]; + IN : WSTRING[__STRING_LENGTH]; END_VAR VAR_INPUT L : DINT; @@ -6574,7 +6574,7 @@ Return: A new string which has L characters replaced by IN2 from position P onwa ***************************************************************************** *) FUNCTION REPLACE < T : ANY_STRING > : T VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR VAR_INPUT @@ -6600,7 +6600,7 @@ END_FUNCTION FUNCTION REPLACE__STRING : STRING[__STRING_LENGTH] VAR_INPUT {ref} - IN1 : STRING[__STRING_LENGTH]; + IN1 : STRING[__STRING_LENGTH]; IN2 : STRING[__STRING_LENGTH]; END_VAR VAR_INPUT @@ -6663,7 +6663,7 @@ Return: The character index of the first match. 0 if there are no matches. {external} FUNCTION FIND < T : ANY_STRING > : DINT VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR END_FUNCTION @@ -6678,7 +6678,7 @@ Return: {external} FUNCTION GT < T : ANY_STRING > : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION @@ -6706,7 +6706,7 @@ Return: {external} FUNCTION GE < T : ANY_STRING > : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION @@ -6720,7 +6720,7 @@ Return: {external} FUNCTION EQ < T : ANY_STRING > : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION @@ -6748,7 +6748,7 @@ Return: {external} FUNCTION LE < T : ANY_STRING > : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION @@ -6762,7 +6762,7 @@ Return: {external} FUNCTION LT < T : ANY_STRING > : BOOL VAR_INPUT {ref} - IN1 : {sized} T...; + IN1 : {sized} T...; END_VAR END_FUNCTION @@ -6790,28 +6790,28 @@ Return: {external} FUNCTION NE < T : ANY_STRING > : BOOL VAR_INPUT {ref} - IN1 : T; + IN1 : T; IN2 : T; END_VAR END_FUNCTION (* Definitions of arithmetic functions defined by the IEC61131-3 standard *) {external} VAR_GLOBAL - PI_REAL : REAL; - PI_LREAL : LREAL; - FRAC_PI_2_REAL : REAL; - FRAC_PI_2_LREAL : LREAL; - FRAC_PI_4_REAL : REAL; - FRAC_PI_4_LREAL : LREAL; - E_REAL : REAL; - E_LREAL : LREAL; + PI_REAL : REAL; + PI_LREAL : LREAL; + FRAC_PI_2_REAL : REAL; + FRAC_PI_2_LREAL : LREAL; + FRAC_PI_4_REAL : REAL; + FRAC_PI_4_LREAL : LREAL; + E_REAL : REAL; + E_LREAL : LREAL; END_VAR (* Calculates the square root of a given value *) {external} FUNCTION SQRT < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6822,7 +6822,7 @@ END_FUNCTION {external} FUNCTION LN < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6831,7 +6831,7 @@ END_FUNCTION {external} FUNCTION LOG < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6839,7 +6839,7 @@ END_FUNCTION {external} FUNCTION EXP < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6850,7 +6850,7 @@ END_FUNCTION {external} FUNCTION SIN < T : ANY_REAL > : T VAR_INPUT - rad : T; + rad : T; END_VAR END_FUNCTION @@ -6858,7 +6858,7 @@ END_FUNCTION {external} FUNCTION COS < T : ANY_REAL > : T VAR_INPUT - rad : T; + rad : T; END_VAR END_FUNCTION @@ -6866,7 +6866,7 @@ END_FUNCTION {external} FUNCTION TAN < T : ANY_REAL > : T VAR_INPUT - rad : T; + rad : T; END_VAR END_FUNCTION @@ -6874,7 +6874,7 @@ END_FUNCTION {external} FUNCTION ASIN < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6882,7 +6882,7 @@ END_FUNCTION {external} FUNCTION ACOS < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6890,7 +6890,7 @@ END_FUNCTION {external} FUNCTION ATAN < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION @@ -6898,32 +6898,32 @@ END_FUNCTION {external} FUNCTION ATAN2 < T : ANY_REAL > : T VAR_INPUT - y : T; - x : T; + y : T; + x : T; END_VAR END_FUNCTION {external} FUNCTION EXPT < T : ANY_REAL, U : ANY_NUM > : T VAR_INPUT - in1 : T; - in2 : U; + in1 : T; + in2 : U; END_VAR END_FUNCTION {external} FUNCTION EXPT__REAL__DINT : REAL VAR_INPUT - in1 : REAL; - in2 : DINT; + in1 : REAL; + in2 : DINT; END_VAR END_FUNCTION {external} FUNCTION EXPT__REAL__REAL : REAL VAR_INPUT - in1 : REAL; - in2 : REAL; + in1 : REAL; + in2 : REAL; END_VAR END_FUNCTION @@ -6933,143 +6933,143 @@ END_FUNCTION {external} FUNCTION EXPT__REAL__LREAL : REAL VAR_INPUT - in1 : REAL; - in2 : LREAL; + in1 : REAL; + in2 : LREAL; END_VAR END_FUNCTION {external} FUNCTION EXPT__LREAL__DINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : DINT; + in1 : LREAL; + in2 : DINT; END_VAR END_FUNCTION {external} FUNCTION EXPT__LREAL__REAL : LREAL VAR_INPUT - in1 : LREAL; - in2 : REAL; + in1 : LREAL; + in2 : REAL; END_VAR END_FUNCTION {external} FUNCTION EXPT__LREAL__LREAL : LREAL VAR_INPUT - in1 : LREAL; - in2 : LREAL; + in1 : LREAL; + in2 : LREAL; END_VAR END_FUNCTION FUNCTION EXPT__REAL__USINT : REAL VAR_INPUT - in1 : REAL; - in2 : USINT; + in1 : REAL; + in2 : USINT; END_VAR EXPT__REAL__USINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__UINT : REAL VAR_INPUT - in1 : REAL; - in2 : UINT; + in1 : REAL; + in2 : UINT; END_VAR EXPT__REAL__UINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__UDINT : REAL VAR_INPUT - in1 : REAL; - in2 : UDINT; + in1 : REAL; + in2 : UDINT; END_VAR EXPT__REAL__UDINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__ULINT : REAL VAR_INPUT - in1 : REAL; - in2 : ULINT; + in1 : REAL; + in2 : ULINT; END_VAR EXPT__REAL__ULINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__SINT : REAL VAR_INPUT - in1 : REAL; - in2 : SINT; + in1 : REAL; + in2 : SINT; END_VAR EXPT__REAL__SINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__INT : REAL VAR_INPUT - in1 : REAL; - in2 : INT; + in1 : REAL; + in2 : INT; END_VAR EXPT__REAL__INT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__REAL__LINT : REAL VAR_INPUT - in1 : REAL; - in2 : LINT; + in1 : REAL; + in2 : LINT; END_VAR EXPT__REAL__LINT := EXPT__REAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__USINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : USINT; + in1 : LREAL; + in2 : USINT; END_VAR EXPT__LREAL__USINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__UINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : UINT; + in1 : LREAL; + in2 : UINT; END_VAR EXPT__LREAL__UINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__UDINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : UDINT; + in1 : LREAL; + in2 : UDINT; END_VAR EXPT__LREAL__UDINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__ULINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : ULINT; + in1 : LREAL; + in2 : ULINT; END_VAR EXPT__LREAL__ULINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__SINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : SINT; + in1 : LREAL; + in2 : SINT; END_VAR EXPT__LREAL__SINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__INT : LREAL VAR_INPUT - in1 : LREAL; - in2 : INT; + in1 : LREAL; + in2 : INT; END_VAR EXPT__LREAL__INT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION FUNCTION EXPT__LREAL__LINT : LREAL VAR_INPUT - in1 : LREAL; - in2 : LINT; + in1 : LREAL; + in2 : LINT; END_VAR EXPT__LREAL__LINT := EXPT__LREAL__DINT(in1, in2); END_FUNCTION @@ -7080,7 +7080,7 @@ END_FUNCTION ************************ *) FUNCTION ABS < T : ANY_NUM > : T VAR_INPUT - IN : T; + IN : T; END_VAR END_FUNCTION @@ -7089,58 +7089,58 @@ END_FUNCTION /* FUNCTION ABS__DINT : DINT */ FUNCTION ABS__DINT : DINT VAR_INPUT - IN : DINT; + IN : DINT; END_VAR - ABS__DINT := IN; - IF ABS__DINT < 0 THEN - ABS__DINT := - 1 * ABS__DINT; - END_IF + ABS__DINT := IN; + IF ABS__DINT < 0 THEN + ABS__DINT := - 1 * ABS__DINT; + END_IF END_FUNCTION (* Specialized implementation of ABS for SINT *) FUNCTION ABS__SINT : SINT VAR_INPUT - IN : SINT; + IN : SINT; END_VAR - ABS__SINT := ABS__DINT(IN); + ABS__SINT := ABS__DINT(IN); END_FUNCTION (* Specialized implementation of ABS for INT *) FUNCTION ABS__INT : INT VAR_INPUT - IN : INT; + IN : INT; END_VAR - ABS__INT := ABS__DINT(IN); + ABS__INT := ABS__DINT(IN); END_FUNCTION (* Specialized implementation of ABS for LINT *) FUNCTION ABS__LINT : LINT VAR_INPUT - IN : LINT; + IN : LINT; END_VAR - ABS__LINT := IN; - IF ABS__LINT < 0 THEN - ABS__LINT := - 1 * ABS__LINT; - END_IF + ABS__LINT := IN; + IF ABS__LINT < 0 THEN + ABS__LINT := - 1 * ABS__LINT; + END_IF END_FUNCTION (* Specialized implementation of ABS for REAL *) FUNCTION ABS__REAL : REAL VAR_INPUT - IN : REAL; + IN : REAL; END_VAR - ABS__REAL := ABS__LREAL(IN); + ABS__REAL := ABS__LREAL(IN); END_FUNCTION (* Specialized implementation of ABS for LREAL *) FUNCTION ABS__LREAL : LREAL VAR_INPUT - IN : LREAL; + IN : LREAL; END_VAR - ABS__LREAL := IN; - IF ABS__LREAL < 0 THEN - ABS__LREAL := - 1.0 * ABS__LREAL; - END_IF + ABS__LREAL := IN; + IF ABS__LREAL < 0 THEN + ABS__LREAL := - 1.0 * ABS__LREAL; + END_IF END_FUNCTION (************************** @@ -7152,7 +7152,7 @@ END_FUNCTION {external} FUNCTION ROUND < T : ANY_REAL > : T VAR_INPUT - in : T; + in : T; END_VAR END_FUNCTION CLASS MyClass @@ -7170,15 +7170,15 @@ END_CLASSPROGRAM name (1 + 2) * (3 + 4); END_PROGRAM FUNCTION smaller_than_ten : BOOL - VAR_INPUT - n : INT; - END_VAR + VAR_INPUT + n : INT; + END_VAR - IF n < 10 THEN - smaller_than_ten := TRUE; - RETURN; - END_IF; - smaller_than_ten := FALSE; + IF n < 10 THEN + smaller_than_ten := TRUE; + RETURN; + END_IF; + smaller_than_ten := FALSE; END_FUNCTION PROGRAM hello VAR @@ -7200,7 +7200,7 @@ FUNCTION a : DINT END_FUNCTION y^.1 := 3; z^[0] := 4; z^[1].1 := 5; - a() := 5; + a() := 5; END_PROGRAM @EXTERNAL FUNCTION LOG : DINT VAR_INPUT @@ -7217,7 +7217,7 @@ END_FUNCTION FUNCTION main : DINT - main := LOG(100); + main := LOG(100); PRINTF('Log value %d\n', main); END_FUNCTION FUNCTION main : DINT @@ -7231,15 +7231,15 @@ END_FUNCTION TYPE MyStruct : STRUCT x : DINT; y : DINT; END_STRUCT END_TYPE FUNCTION main : DINT - main := foo(); + main := foo(); END_FUNCTION FUNCTION foo : DINT VAR - x : DINT; - s : MyStruct; - u, y : REF_TO DINT; - z : REF_TO REF_TO DINT; + x : DINT; + s : MyStruct; + u, y : REF_TO DINT; + z : REF_TO REF_TO DINT; END_VAR u := NULL; @@ -7260,7 +7260,7 @@ END_VAR END_FUNCTION FUNCTION main : DINT - puts('hello, world!$N'); + puts('hello, world!$N'); END_FUNCTION PROGRAM hello VAR @@ -7280,14 +7280,14 @@ END_IF; END_PROGRAM PROGRAM exp a AND NOT b OR c XOR d; END_PROGRAMPROGRAM prg VAR - a : INT; - b : REAL; + a : INT; + b : REAL; END_VAR - b := 1.5; - a := b; + b := 1.5; + a := b; END_PROGRAM PROGRAM a -(* C�mment *) +(* Comment *) END_PROGRAM PROGRAM a VAR @@ -7309,11 +7309,11 @@ PROGRAM a END_VAR END_PROGRAM PROGRAM a -(* Cömment *) +(* Comment *) END_PROGRAM FUNCTION myFunc : DINT VAR_INPUT - a, b, c : DINT; + a, b, c : DINT; END_VAR END_FUNCTION FUNCTION foo2 : LINT @@ -7321,9 +7321,9 @@ FUNCTION foo2 : LINT END_FUNCTION{external} FUNCTION CONCAT_DATE < T : ANY_INT > : DATE VAR_INPUT - year : T; - month : T; - day : T; + year : T; + month : T; + day : T; END_VAR END_FUNCTION @@ -7341,47 +7341,47 @@ main := mainProg.a; END_FUNCTION PROGRAM mainProg VAR - a : DINT := 0; + a : DINT := 0; END_VAR a := 42; END_PROGRAM FUNCTION foo1 : LINT foo1 := CONCAT_DATE(INT#1, SINT#2, SINT#3); END_FUNCTIONVAR_GLOBAL CONSTANT - myValue : BOOL := TRUE; + myValue : BOOL := TRUE; END_VAR FUNCTION_BLOCK myFb2 - VAR - fb : myFb; - END_VAR + VAR + fb : myFb; + END_VAR END_FUNCTION_BLOCK VAR_GLOBAL CONSTANT - myValue2 : BOOL := TRUE; + myValue2 : BOOL := TRUE; END_VAR VAR_GLOBAL CONSTANT - myValue : BOOL := TRUE; + myValue : BOOL := TRUE; END_VAR FUNCTION_BLOCK myFB - VAR - myS : myStruct := (a := 2); - END_VAR + VAR + myS : myStruct := (a := 2); + END_VAR END_FUNCTION_BLOCK {external} FUNCTION func1 : DINT END_FUNCTION FUNCTION func2 : DINT - func1(); + func1(); END_FUNCTION FUNCTION relative : DINT END_FUNCTION TYPE myStruct : STRUCT - a : INT := 5; - b : DINT := 6; + a : INT := 5; + b : DINT := 6; END_STRUCT END_TYPE {external} @@ -7389,7 +7389,7 @@ FUNCTION func2 : DINT END_FUNCTION FUNCTION func1 : DINT - func2(); + func2(); END_FUNCTION PROGRAM name @@ -7406,11 +7406,11 @@ END_VAR END_PROGRAM PROGRAM prg VAR - a : INT; - b : REAL; + a : INT; + b : REAL; END_VAR - b := 1.5; - a := b; + b := 1.5; + a := b; END_PROGRAM VAR_GLOBAL flags : ARRAY[1..500_000_000] OF BOOL; @@ -7463,4 +7463,4 @@ PROGRAM mainProg node : ARRAY[0..15] OF struc2 := ((param1 := 1, param2 := 2), (param1 := 3, param2 := 4)); // node : ARRAY[0..15] OF struct2 := [(param1 := 1, param2 := 2), (param1 := 3, param2 := 4)]; END_VAR -END_PROGRAM \ No newline at end of file +END_PROGRAM diff --git a/xtask/res/sieve.st b/xtask/res/sieve.st index 56b4c982b9..bb98240f7e 100644 --- a/xtask/res/sieve.st +++ b/xtask/res/sieve.st @@ -37,4 +37,4 @@ END_FUNCTION FUNCTION printf : DINT VAR_INPUT {ref} format : STRING; END_VAR VAR_INPUT args : ...; END_VAR -END_FUNCTION \ No newline at end of file +END_FUNCTION diff --git a/xtask/src/task/lexer.rs b/xtask/src/task/lexer.rs index 966037f995..83a7eebd10 100644 --- a/xtask/src/task/lexer.rs +++ b/xtask/src/task/lexer.rs @@ -26,7 +26,7 @@ impl Task for Lexer { let elapsed = now.elapsed(); assert_eq!(lexer.token, plc::lexer::Token::End); - assert_eq!(lexer.last_range, 139145..139156); + assert_eq!(lexer.last_range, 143145..143156); Ok(elapsed) }