mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
Adding indenting for Fortran syntax highlighting, fixing examples to
correspond to that.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user