! This is a set of smart indent macros for Fortran90. ! You can Email me with any suggestions or problems. ! ! Aonghus O Nia ! aonghus.onia@nuigalway.ie ! ! In NEdit Version 5.0.1 and beyond, load this pattern by starting nedit with: ! ! nedit -import f90.ind ! ! Then, check that the macros work properly, and choose Save Defaults from the ! Preferences menu. The smart-indent macros will now be incorporated into ! your own .nedit file, so the next time you start NEdit, you will no longer ! need to use -import. ! ! In version 5.0, without -import, you must edit your .nedit file by hand and ! add the contents of each resource below to the corresponding list in your ! .nedit file. Be sure to separate new entries with \n, and continue resource ! strings by escaping all newlines within a resource value with \ (backslash), ! leaving only the last line of the resource value not ending in \. ! ! ! nedit.smartIndentInit: Fortran90: $Fortran90_indent = 2\n\ \n\ define ReturnIndent { \n\ linestart = search("^", $cursor, "regex", "backward")\n\ currentline = get_range(linestart, $cursor)\n\ oldindent=search_string(currentline, "[^ \\t]", 0, "regex")\n\ lastend=linestart-1\n\ laststart=search("^", lastend, "regex", "backward")\n\ lastline= get_range(laststart, lastend) \n\ lastindent=search_string(lastline, "[^ \\t]", 0, "regex")\n\ if (search_string(currentline, "[eE][nN][dD]", 0, "regex") != -1){\n\ if (search_string(currentline, "[sS][uU][bB][rR][oO][uU][tT][iI][nN][eE]", 0, "regex") != -1) {\n\ return oldindent\n\ }else if (search_string(currentline, "[pP][rR][oO][gG][rR][aA][mM]", 0, "regex") != -1) {\n\ return oldindent\n\ }else{ \n\ if (lastindent == oldindent) {\n\ replace_range(linestart, linestart+$Fortran90_indent, "")\n\ return oldindent-$Fortran90_indent \n\ }else{\n\ return oldindent\n\ }\n\ } \n\ }else if (search_string(currentline, "[eE][lL][sS][eE]", 0, "regex") != -1){\n\ if (lastindent == oldindent) {\n\ replace_range(linestart, linestart+$Fortran90_indent, "") \n\ return oldindent \n\ }else{\n\ return oldindent+$Fortran90_indent\n\ } \n\ }else if (search_string(currentline, "[iI][fF]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else if (search_string(currentline, "[dD][oO]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else if (search_string(currentline, "[wW][hH][eE][rR][eE]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else if (search_string(currentline, "[mM][oO][dD][uU][lL][eE]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else if (search_string(currentline, "[tT][yY][pP][eE]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else if (search_string(currentline, "[fF][uU][nN][cC][tT][iI][oO][nN]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else if (search_string(currentline, "[iI][nN][tT][eE][fF][aA][cC][eE]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent \n\ }else if (search_string(currentline, "[sS][eE][lL][eE][cC][tT]", 0, "regex") != -1){\n\ return oldindent \n\ }else if (search_string(currentline, "[cC][aA][sS][eE]", 0, "regex") != -1){\n\ if (lastindent == oldindent) {\n\ if(search_string(lastline, "[sS][eE][lL][eE][cC][tT]", 0, "regex") != -1){\n\ return oldindent+$Fortran90_indent\n\ }else{\n\ replace_range(linestart, linestart+$Fortran90_indent, "")\n\ return oldindent\n\ }\n\ }else{\n\ return oldindent+$Fortran90_indent\n\ }\n\ }else{\n\ return oldindent\n\ } \n\ }\n\ \n\ \n\ \n\ --End-of-Macro--\n\ return ReturnIndent()\n\ --End-of-Macro--\n\ --End-of-Macro--