'*******************************************************************************
' EverEdit Syntax File
' Language: 	Fortran
' Maintainer:	www.everedit.net
' History:
' 2013/04/26 	First Version
'*******************************************************************************
Include( ".\const.mac" )

Set ft=CreateParser()

Set rComment1=ft.CreateRegion(COLOR_COMMENT1, "^c", "$", False )
Set rComment2=ft.CreateRegion(COLOR_COMMENT1, "+!+", "$", False )

Set rString1=ft.CreateStringRegion( COLOR_STRING1, "'", "", True )
Set rString2=ft.CreateStringRegion( COLOR_STRING2, """", "", True )

'Statement Specifiers
Set iWord1=ft.CreateWord(COLOR_WORD1, "ACCESS BLANK EXIST FILE FORM FORMATTED IOSTAT NAME NAMED NEXTREC NUMBER OPENED RECL SEQUENTIAL STATUS UNFORMATTED UNIT", False)
iWord1.AutoCase=True

'Reserved words
Set iWord2=ft.CreateWord(COLOR_WORD2, "ASSIGN BACKSPACE COMMON BLANK BLOCK DATA BN CALL CHARACTER CLOSE COMMON COMPLEX CONTINUE DATA DIMENSION DIRECT DO ENDDO DOUBLE PRECISION ELSE ELSEIF END ENDFILE ENTRY EQUIVALENCE ERR EXTERNAL FORMAT FUNCTION GOTO IF ENDIF IMPLICIT INQUIRE INTEGER LOGICAL OPEN PARAMETER PRINT PROGRAM READ REAL RETURN REWIND SAVE STOP SUBROUTINE THEN WHILE WRITE INCLUDE MODULE USE", False)
iWord2.AutoCase=True

'Conditional Statements
Set iItem1=ft.CreateItem(COLOR_WORD3, "\.(AND|EQ|EQV|FALSE|GE|GT|LE|LT|NE|NEQV|NOT|OR|TRUE)\.", False)

ft.AddRegion( rComment1 )
ft.AddRegion( rComment2 )
ft.AddRegion( rString1 )
ft.AddRegion( rString2 )

ft.AddWord( iWord1 )
ft.AddWord( iWord2 )
ft.AddItem( iItem1 )

'number
ft.AddItem( ft.CreateItem(COLOR_NUMBER, "\b\d+\b", False) )
ft.AddItem( ft.CreateItem(COLOR_OPERATOR, "[\{\}\(\)\+\-\*\\=%&\^!~\|<>?\.,:;\/\[\]]",False ) )

ft.IndentText "\b((?<!end\s)do|(?<!end\s)if|then|else|case)\b", False, "\b(end|else)\b", False

ft.FoldText "\b((?<!end\s)do|(?<!end\s)module|(?<!end\s)function|(?<!end\s)subroutine|(?<!end\s)program)\b", False, "\b(end\s?do|end(?!\s(do|if)))\b", False

ft.SetPairs( "[]''""""{}()" )
ft.CommentLine( "!" )
