Adding indenting for Fortran syntax highlighting, fixing examples to

correspond to that.
This commit is contained in:
dbroemmel
2018-06-06 15:41:57 +00:00
committed by D. Broemmel
parent f81994061f
commit 012459a252
3 changed files with 38 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
! Type your code here, or load an example.
real function square(x)
implicit none
real, intent(in) :: x
square = x * x
return
implicit none
real, intent(in) :: x
square = x * x
return
end function square

View File

@@ -2,20 +2,20 @@
! Try changing the target architecture to AVX (-mavx)
! and enabling optimisation (-O3) and compare the results.
real function dot_prod(a, b)
implicit none
real, intent(in), dimension(4) :: a, b
real, dimension(4) :: temp
integer :: i
do i = 1, 4
temp(i) = a(i) * b(i)
end do
dot_prod = 0.
do i = 1,4
dot_prod = dot_prod + temp(i)
end do
return
implicit none
real, intent(in), dimension(4) :: a, b
real, dimension(4) :: temp
integer :: i
do i = 1, 4
temp(i) = a(i) * b(i)
end do
dot_prod = 0.
do i = 1,4
dot_prod = dot_prod + temp(i)
end do
return
end function dot_prod

View File

@@ -532,31 +532,40 @@ function configuration() {
},
brackets: [
['{', '}'],
['(\/', '\/)'],
['[', ']'],
['(', ')']
],
autoClosingPairs: [
{open: '{', close: '}'},
{open: '[', close: ']'},
{open: '(', close: ')'},
{open: '`', close: '`', notIn: ['string']},
{open: '"', close: '"', notIn: ['string']},
{open: '\'', close: '\'', notIn: ['string', 'comment']}
{open: '`', close: '`', notIn: ['string','comment']},
{open: '\'', close: '\'', notIn: ['string','comment']},
{open: '"', close: '"', notIn: ['string']}
],
surroundingPairs: [
{open: '{', close: '}'},
{open: '[', close: ']'},
{open: '(', close: ')'},
{open: '`', close: '`'},
{open: '"', close: '"'},
{open: '\'', close: '\''}
]
{open: '\'', close: '\''},
{open: '"', close: '"'}
],
indentationRules: {
decreaseIndentPattern: /end\s*(do|if|function|subroutine|program|block|associate|forall)/,
increaseIndentPattern: /^((?!end).)*(do\s|if(\s|\()|function\s|subroutine\s|program\s|block\s*|associate(\s|\()|forall)/,
unIndentedLinePattern: null
}
};
}
var def = definition();
monaco.languages.register({id: 'fortran'});
monaco.languages.setMonarchTokensProvider('fortran', definition());
monaco.languages.setLanguageConfiguration('fortran', configuration());
module.exports = def;