Browse Source

Colors updated, AutoHotkey and Verilog syntax highlighting

Stepan Mitkin 4 years ago
parent
commit
ed93ef239a

BIN
generators/AutoHotkey_L.drn


+ 146 - 1
generators/AutoHotkey_L.tcl

@@ -2,8 +2,13 @@ gen::add_generator AutoHotkey_L gen_AutoHotkey_L::generate
 
 namespace eval gen_AutoHotkey_L {
 
+variable keywords {
+and or not
+Break Continue Exit ExitApp Gosub Goto If Else IfEqual IfExist IfGreater IfGreaterOrEqual IfInString IfLess IfLessOrEqual IfMsgBox IfNotEqual IfNotExist IfNotInString IfWinActive IfWinExist IfWinNotActive IfWinNotExist Loop OnExit Pause Return SetTimer Shutdown
+HKEY_LOCAL_MACHINE HKEY_USERS HKEY_CURRENT_USER HKEY_CLASSES_ROOT HKEY_CURRENT_CONFIG HKLM HKU HKCU HKCR HKCC REG_SZ REG_EXPAND_SZ REG_MULTI_SZ REG_DWORD REG_BINARY
+}
 
-# Autogenerated with DRAKON Editor 1.23
+# Autogenerated with DRAKON Editor 1.25
 
 proc assign { variable value } {
     #item 1398
@@ -230,6 +235,146 @@ proc goto { text } {
     return "goto, $text"
 }
 
+proc highlight { tokens } {
+    #item 1889
+    set result {}
+    #item 1890
+    set state "idle"
+    #item 1930
+    variable keywords
+    #item 18960001
+    set _col1896 $tokens
+    set _len1896 [ llength $_col1896 ]
+    set _ind1896 0
+    while { 1 } {
+        #item 18960002
+        if {$_ind1896 < $_len1896} {
+            
+        } else {
+            break
+        }
+        #item 18960004
+        set token [ lindex $_col1896 $_ind1896 ]
+        #item 1978
+        lassign $token type text
+        #item 18910001
+        if {$state == "idle"} {
+            #item 19060001
+            if {$text == "\""} {
+                #item 1931
+                lappend result \
+                  $colors::syntax_string
+                #item 1913
+                set state "string"
+            } else {
+                #item 19060002
+                if {$text == ";"} {
+                    #item 1972
+                    lappend result \
+                      $colors::syntax_comment
+                    #item 1971
+                    set state "comment"
+                } else {
+                    #item 19160001
+                    if {$type == "op"} {
+                        #item 1924
+                        lappend result \
+                          $colors::syntax_operator
+                    } else {
+                        #item 19160002
+                        if {$type == "number"} {
+                            #item 1923
+                            lappend result \
+                              $colors::syntax_number
+                        } else {
+                            #item 19160003
+                            if {($type == "token") && ([contains $keywords $text])} {
+                                #item 1928
+                                lappend result \
+                                  $colors::syntax_keyword
+                            } else {
+                                #item 1925
+                                lappend result \
+                                  $colors::syntax_identifier
+                            }
+                        }
+                    }
+                }
+            }
+        } else {
+            #item 18910002
+            if {$state == "string"} {
+                #item 19330001
+                if {$text == "\""} {
+                    #item 1940
+                    lappend result \
+                      $colors::syntax_string
+                    #item 1941
+                    set state "idle"
+                } else {
+                    #item 19330002
+                    if {$text == "`"} {
+                        #item 1979
+                        lappend result \
+                          $colors::syntax_string
+                        #item 1942
+                        set state "escaping"
+                    } else {
+                        #item 19330003
+                        if {$text == "\n"} {
+                            #item 1980
+                            lappend result \
+                              $colors::syntax_string
+                            #item 1945
+                            set state "idle"
+                        } else {
+                            #item 1981
+                            lappend result \
+                              $colors::syntax_string
+                        }
+                    }
+                }
+            } else {
+                #item 18910003
+                if {$state == "escaping"} {
+                    #item 1947
+                    lappend result $colors::syntax_string
+                    #item 1963
+                    if {$text == "\n"} {
+                        #item 1965
+                        set state "idle"
+                    } else {
+                        #item 1946
+                        set state "string"
+                    }
+                } else {
+                    #item 18910004
+                    if {$state == "comment"} {
+                        
+                    } else {
+                        #item 18910005
+                        error "Unexpected switch value: $state"
+                    }
+                    #item 1973
+                    lappend result \
+                      $colors::syntax_comment
+                    #item 1974
+                    if {$text == "\n"} {
+                        #item 1976
+                        set state "idle"
+                    } else {
+                        
+                    }
+                }
+            }
+        }
+        #item 18960003
+        incr _ind1896
+    }
+    #item 1888
+    return $result
+}
+
 proc if_end { } {
     #item 1797
     return "\) \{"

BIN
generators/lua.drn


BIN
generators/python.drn


+ 2 - 1
generators/tcl.tcl

@@ -5,7 +5,8 @@ namespace eval gen_tcl {
 
 variable keywords
 
-array set keywords { append 1
+array set keywords { 
+append 1
 binary 1
 format 1
 regexp 1

BIN
generators/verilog.drn


+ 305 - 1
generators/verilog.tcl

@@ -34,7 +34,134 @@ namespace eval verilog_gen {
     
     variable tdb ""
 
-# Autogenerated with DRAKON Editor 1.23
+
+variable keywords {
+always
+and
+assign
+automatic
+begin
+buf
+bufif0
+bufif1
+case
+casex
+casez
+cell
+cmos
+config
+deassign
+default
+defparam
+design
+disable
+edge
+else
+end
+endcase
+endconfig
+endfunction
+endgenerate
+endmodule
+endprimitive
+endspecify
+endtable
+endtask
+event
+for
+force
+forever
+fork
+function
+generate
+genvar
+highz0
+highz1
+if
+ifnone
+incdir
+include
+initial
+inout
+input
+instance
+integer
+join
+large
+liblist
+library
+localparam
+macromodule
+medium
+module
+nand
+negedge
+nmos
+nor
+noshowcancelledno
+not
+notif0
+notif1
+or
+output
+parameter
+pmos
+posedge
+primitive
+pull0
+pull1
+pulldown
+pullup
+pulsestyle_oneventglitch
+pulsestyle_ondetectglitch
+remos
+real
+realtime
+reg
+release
+repeat
+rnmos
+rpmos
+rtran
+rtranif0
+rtranif1
+scalared
+showcancelled
+signed
+small
+specify
+specparam
+strong0
+strong1
+supply0
+supply1
+table
+task
+time
+tran
+tranif0
+tranif1
+tri
+tri0
+tri1
+triand
+trior
+trireg
+unsigned
+use
+vectored
+wait
+wand
+weak0
+weak1
+while
+wire
+wor
+xnor
+xor
+}
+
+# Autogenerated with DRAKON Editor 1.25
 
 proc build_always_block { name keyword parameters extra_reset body } {
     #item 729
@@ -1547,6 +1674,183 @@ proc has_init { gdb } {
     return $found
 }
 
+proc highlight { tokens } {
+    #item 2154
+    set result {}
+    #item 2155
+    set state "idle"
+    #item 2172
+    variable keywords
+    #item 21610001
+    set _col2161 $tokens
+    set _len2161 [ llength $_col2161 ]
+    set _ind2161 0
+    while { 1 } {
+        #item 21610002
+        if {$_ind2161 < $_len2161} {
+            
+        } else {
+            break
+        }
+        #item 21610004
+        set token [ lindex $_col2161 $_ind2161 ]
+        #item 2214
+        lassign $token type text
+        #item 21560001
+        if {$state == "idle"} {
+            #item 2224
+            set state [ idle_default \
+              $keywords result $type $text ]
+        } else {
+            #item 21560002
+            if {$state == "string"} {
+                #item 21730001
+                if {$text == "\""} {
+                    #item 2180
+                    lappend result \
+                      $colors::syntax_string
+                    #item 2181
+                    set state "idle"
+                } else {
+                    #item 21730002
+                    if {$text == "\\"} {
+                        #item 2215
+                        lappend result \
+                          $colors::syntax_string
+                        #item 2182
+                        set state "escaping"
+                    } else {
+                        #item 21730003
+                        if {$text == "\n"} {
+                            #item 2216
+                            lappend result \
+                              $colors::syntax_string
+                            #item 2185
+                            set state "idle"
+                        } else {
+                            #item 2217
+                            lappend result \
+                              $colors::syntax_string
+                        }
+                    }
+                }
+            } else {
+                #item 21560003
+                if {$state == "escaping"} {
+                    #item 2187
+                    lappend result $colors::syntax_string
+                    #item 2186
+                    set state "string"
+                } else {
+                    #item 21560004
+                    if {$state == "comment start"} {
+                        #item 2221
+                        if {$text == "/"} {
+                            #item 2220
+                            lappend result \
+                              $colors::syntax_comment \
+                              $colors::syntax_comment
+                            #item 2223
+                            set state "comment"
+                        } else {
+                            #item 2226
+                            lappend result \
+                             $colors::syntax_operator
+                            #item 2225
+                            set state [ idle_default \
+                              $keywords result $type $text ]
+                        }
+                    } else {
+                        #item 21560005
+                        if {$state == "comment"} {
+                            
+                        } else {
+                            #item 21560006
+                            error "Unexpected switch value: $state"
+                        }
+                        #item 2209
+                        lappend result \
+                          $colors::syntax_comment
+                        #item 2210
+                        if {$text == "\n"} {
+                            #item 2212
+                            set state "idle"
+                        } else {
+                            
+                        }
+                    }
+                }
+            }
+        }
+        #item 21610003
+        incr _ind2161
+    }
+    #item 2227
+    if {$state == "comment start"} {
+        #item 2230
+        lappend result \
+         $colors::syntax_operator
+    } else {
+        
+    }
+    #item 2153
+    return $result
+}
+
+proc idle_default { keywords result_name type text } {
+    #item 2236
+    upvar 1 $result_name result
+    #item 22370001
+    if {$text == "\""} {
+        #item 2260
+        lappend result \
+          $colors::syntax_string
+        #item 2244
+        set state "string"
+    } else {
+        #item 22370002
+        if {$text == "/"} {
+            #item 2264
+            set state "comment start"
+        } else {
+            #item 22460001
+            if {$type == "op"} {
+                #item 2254
+                lappend result \
+                  $colors::syntax_operator
+                #item 2265
+                set state "idle"
+            } else {
+                #item 22460002
+                if {$type == "number"} {
+                    #item 2253
+                    lappend result \
+                      $colors::syntax_number
+                    #item 2266
+                    set state "idle"
+                } else {
+                    #item 22460003
+                    if {($type == "token") && ([contains $keywords $text])} {
+                        #item 2258
+                        lappend result \
+                          $colors::syntax_keyword
+                        #item 2269
+                        set state "idle"
+                    } else {
+                        #item 2255
+                        lappend result \
+                          $colors::syntax_identifier
+                        #item 2270
+                        set state "idle"
+                    }
+                }
+            }
+        }
+    }
+    #item 2268
+    return $state
+}
+
 proc inspect_tree { node name } {
     
 }

+ 15 - 15
scripts/global_props.tcl

@@ -57,13 +57,13 @@ variable strict {
 }
 
 variable parrot {
-	background 	"#d0d0ff"
+	background 	"#C3E7EF"
 	line 			"#000000"
 	text 			"#000000"
 	action	 	"#ffffff"
-	if 			"#ffffd0"
-	switch	 	"#ffd0d0"
-	loop			"#d0ffd0"
+	if 			"#ffffe8"
+	switch	 	"#ffe8e8"
+	loop			"#e8ffe8"
 	comment		"#ffff00"
 	comment_s		"#909090"
 	syntax_identifier "#000000"
@@ -76,7 +76,7 @@ variable parrot {
 
 variable black {
 	background 	"#000000"
-	line 			"#909090"
+	line 			"#707070"
 	text 			"#ffffff"
 	action	 	"#000000"
 	if 			"#000000"
@@ -84,17 +84,17 @@ variable black {
 	loop			"#000000"
 	comment		"#303030"
 	comment_s		"#303030"
-	syntax_identifier "#e0e0e0"
+	syntax_identifier "#c0c0c0"
 	syntax_string "#909090"
 	syntax_keyword "#b0b0b0"
 	syntax_number "#ffffff"
 	syntax_comment "#505050"
-	syntax_operator "#dddddd"  
+	syntax_operator "#ffffff"  
 }
 
 variable night {
 	background 	"#000040"
-	line 			"#8080c0"
+	line 			"#7070c0"
 	text 			"#ffffaa"
 	action	 	"#000000"
 	if 			"#000000"
@@ -103,16 +103,16 @@ variable night {
 	comment		"#0000a0"
 	comment_s		"#0000a0"
 	syntax_identifier "#BCD5FF"
-	syntax_string "#48629F"
+	syntax_string "#6882aF"
 	syntax_keyword "#70A5FF"
 	syntax_number "#ffffff"
 	syntax_comment "#808080"
-	syntax_operator "#86B3FF"  
+	syntax_operator "#ffffff"  
 }
 
 variable colored_night {
 	background 	"#000040"
-	line 			"#8080c0"
+	line 			"#7070c0"
 	text 			"#ffffaa"
 	action	 	"#000000"
 	if 			"#202000"
@@ -120,12 +120,12 @@ variable colored_night {
 	loop			"#002500"
 	comment		"#0000a0"
 	comment_s		"#0000a0"
-	syntax_identifier "#EBD9C0"
-	syntax_string "#CC8623"
-	syntax_keyword "#6CCC88"
+	syntax_identifier "#FBF9C0"
+	syntax_string "#dC8623"
+	syntax_keyword "#ABFFCF"
 	syntax_number "#ffffff"
 	syntax_comment "#808080"
-	syntax_operator "#ABEBCF"
+	syntax_operator "#6CCC88"
 }
 
 #	syntax_identifier "#EBD9C0"

BIN
testdata/hi_auto.drn


BIN
testdata/hi_erlang.drn


BIN
testdata/hi_lua.drn


BIN
testdata/hi_python.drn


BIN
testdata/hi_tcl.drn


BIN
testdata/hi_veri.drn