Skip to content

Updated grammar unittests to include scope injections #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Changed

- Updated grammar unittests to include scope injections
- Merged Language Server's log channel to Modern Fortran's log channel
- Merged all Fortran intrinsics into a single `json` file
([#424](https://github.com/fortran-lang/vscode-fortran-support/issues/424))
Expand Down
55 changes: 29 additions & 26 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@
"webpack": "webpack --mode production",
"pretest": "npm run compile-dev && tsc -p tsconfig.test.json",
"test": "node ./out/test/runTest.js",
"test:grammar-free": "vscode-tmgrammar-snap -s source.fortran.free -g ./syntaxes/fortran_free-form.tmLanguage.json -t \"./test/**/*{.f90,F90}\"",
"test:grammar-fixed": "vscode-tmgrammar-snap -s source.fortran.fixed -g ./syntaxes/fortran_fixed-form.tmLanguage.json -t \"./test/**/*{.f,F}\"",
"test:grammar-free": "vscode-tmgrammar-snap -s source.fortran.free -g ./syntaxes/fortran_free-form.tmLanguage.json \"./test/**/*{.f90,F90}\"",
"test:grammar-fixed": "vscode-tmgrammar-snap -s source.fortran.fixed -g ./syntaxes/fortran_fixed-form.tmLanguage.json \"./test/**/*{.f,F}\"",
"test:grammar": "npm run test:grammar-free && npm run test:grammar-fixed",
"test:grammar-update": "npm run test:grammar-free -- -u && npm run test:grammar-fixed -- -u",
"lint": "eslint . --ext .ts,.tsx",
Expand Down Expand Up @@ -397,7 +397,7 @@
"prettier": "^2.5.1",
"ts-loader": "^9.2.6",
"typescript": "^4.5.5",
"vscode-tmgrammar-test": "^0.0.11",
"vscode-tmgrammar-test": "^0.1.1",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
},
Expand Down
203 changes: 203 additions & 0 deletions test/resources/auxilary_functions.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
C ================================================================
real Function sqrEdge(xy1, xy2)
C ================================================================
C Routine computes sqruare distance between two points
C ================================================================
real xy1(2), xy2(2)

sqrEdge = (xy1(1) - xy2(1)) ** 2 + (xy1(2) - xy2(2)) ** 2
Return
End


C ================================================================
real Function calEdge(xy1, xy2)
C ================================================================
C Routine computes distance between two points
C ================================================================
real xy1(2), xy2(2)

calEdge = sqrt((xy1(1) - xy2(1)) ** 2 +
& (xy1(2) - xy2(2)) ** 2)
Return
End



C ================================================================
real Function calNorm(xy1)
C ================================================================
C Routine calculates norm of vector xy1
C ================================================================
real xy1(2)

calNorm = sqrt(xy1(1) ** 2 + xy1(2) ** 2)
Return
End



C ================================================================
Subroutine extNormal(xy1, xy2, xy3, xyn)
C ================================================================
C Routines compute external normal vector to the edge {xy1, xy2}
C of triangle {xy1, xy2, xy3}
C ================================================================
real xy1(2), xy2(2), xy3(2), xyn(2)
real x, y, d

x = xy2(1) - xy1(1)
y = xy2(2) - xy1(2)

d = sqrt(x * x + y * y)

xyn(1) = -y / d
xyn(2) = x / d

c ... orientation
x = xy3(1) - xy1(1)
y = xy3(2) - xy1(2)

If( x*xyn(1) + y*xyn(2).GT.0D0 ) Then
xyn(1) = -xyn(1)
xyn(2) = -xyn(2)
End if

Return
End


C ================================================================
Subroutine calNormal(xy1, xy2, xyn)
C ================================================================
C Routines compute a normal vector to the edge {xy1, xy2}
C ================================================================
real xy1(2), xy2(2), xyn(2)
real x, y, d

x = xy2(1) - xy1(1)
y = xy2(2) - xy1(2)

d = sqrt(x * x + y * y)

xyn(1) = -y / d
xyn(2) = x / d

Return
End



C ================================================================
real Function DotMul(a, b)
C ================================================================
C Routine computes scalar product of two vectors
C ================================================================
real a(2), b(2)

DotMul = a(1) * b(1) + a(2) * b(2)
Return
End



C ================================================================
real Function VecMul(a, b)
C ================================================================
C Routine computes vector product a x b which is a number in 2D.
C ================================================================
real a(2), b(2)

VecMul = a(1) * b(2) - a(2) * b(1)
Return
End



C ================================================================
Logical Function check1j(i1, j)
C ================================================================
C check1j = TRUE if i1 belongs to the set j(3).
C ================================================================
Integer j(3)

check1j = .TRUE.
If(i1.EQ.j(1)) goto 1000
If(i1.EQ.j(2)) goto 1000
If(i1.EQ.j(3)) goto 1000

check1j = .FALSE.
1000 Return
End



C ================================================================
Logical Function check12(i1, j1, j2)
C ================================================================
C check12 = TRUE if i1 belongs to the set {j1, j2}.
C ================================================================
check12 = .TRUE.
If(i1.EQ.j1) goto 1000
If(i1.EQ.j2) goto 1000

check12 = .FALSE.
1000 Return
End


C ================================================================
Logical Function check22(i1, i2, j1, j2)
C ================================================================
C check22 = TRUE if pair {i1, i2} coinsides with {j1, j2}.
C ================================================================
check22 = .FALSE.
If(i1.NE.j1 .AND. i1.NE.j2) goto 1000
If(i2.NE.j1 .AND. i2.NE.j2) goto 1000

check22 = .TRUE.
1000 Return
End


C ================================================================
Subroutine swapii(i1, i2)
C ================================================================
C Routine swaps two integers
C ================================================================
i = i1
i1 = i2
i2 = i

Return
End



C ================================================================
Subroutine swapdd(d1, d2)
C ================================================================
C Routine swaps two real numbers
C ================================================================
real d, d1, d2
d = d1
d1 = d2
d2 = d

Return
End


C ================================================================
Subroutine paramInclude(d1, d2)
C ================================================================
C Dummy function to test includes on hover
C ================================================================
include "parameters.prm"
real d, d1, d2
d = AniRatio
d1 = AniEigenvalue
d2 = DiscreteGrad

Return
End
Loading