Przeglądaj źródła

the actual elisp

john melesky 1 dzień temu
rodzic
commit
457c617855
1 zmienionych plików z 395 dodań i 0 usunięć
  1. 395 0
      endless-sky-mode.el

+ 395 - 0
endless-sky-mode.el

@@ -0,0 +1,395 @@
+(defvar endless-sky-constants
+  '("color"
+    "conversation"
+    "effect"
+    "event"
+    "fleet"
+    "galaxy"
+    "government"
+    "hazard"
+    "interface"
+    "mission"
+    "news"
+    "outfit"
+    "outfitter"
+    "person"
+    "phrase"
+    "planet"
+    "ship"
+    "shipyard"
+    "start"
+    "substitution"
+    "system"
+    "true"
+    "false"
+    "trade"))
+  
+(defvar endless-sky-builtins
+  '(
+    "Drone"
+    "Fighter"
+    "Fine"
+    "Mortgage"
+    "abort"
+    "absolute"
+    "accept"
+    "accompany"
+    "account"
+    "action"
+    "active"
+    "addend"
+    "afterburner"
+    "ammo"
+    "angle"
+    "anti-missile"
+    "apparent"
+    "arrival"
+    "assist"
+    "assisting"
+    "asteroid"
+    "atmosphere"
+    "atrocities"
+    "atrocity"
+    "attitude"
+    "attributes"
+    "automaton"
+    "back"
+    "bay"
+    "belt"
+    "blast"
+    "blast"
+    "blocked"
+    "board"
+    "boarding"
+    "branch"
+    "bribe"
+    "brightness"
+    "bunks"
+    "burn"
+    "burst"
+    "capacity"
+    "capture"
+    "cargo"
+    "category"
+    "chance"
+    "choice"
+    "clear"
+    "clearance"
+    "cloak"
+    "cloaking"
+    "cluster"
+    "collection"
+    "commodities"
+    "complete"
+    "concealment"
+    "conditions"
+    "confusion"
+    "constant"
+    "consumption"
+    "cooling"
+    "corrosion"
+    "cost"
+    "costs"
+    "count"
+    "credits"
+    "crew"
+    "custom"
+    "daily"
+    "damage"
+    "date"
+    "deadline"
+    "death"
+    "decline"
+    "defer"
+    "delay"
+    "density"
+    "departure"
+    "depleted"
+    "description"
+    "despawn"
+    "destination"
+    "destruct"
+    "dialog"
+    "die"
+    "disable"
+    "disabled"
+    "discharge"
+    "display"
+    "disruption"
+    "dissipation"
+    "distance"
+    "drag"
+    "drive"
+    "dropoff"
+    "duration"
+    "efficiency"
+    "energy"
+    "enforces"
+    "engine"
+    "enter"
+    "environmental"
+    "equivalent"
+    "evade"
+    "event"
+    "explode"
+    "facing"
+    "fail"
+    "fence"
+    "fighters"
+    "final"
+    "fine"
+    "fire"
+    "firing"
+    "flare"
+    "flotsam"
+    "force"
+    "foreign"
+    "frame"
+    "frequency"
+    "friendly"
+    "fuel"
+    "generation"
+    "give"
+    "goto"
+    "government"
+    "gravitational"
+    "gun"
+    "habitable"
+    "hail"
+    "hardpoint"
+    "hazard"
+    "haze"
+    "heat"
+    "hidden"
+    "history"
+    "hit"
+    "homing"
+    "hostile"
+    "hull"
+    "hyperdrive"
+    "icon"
+    "illegal"
+    "illegals"
+    "inaccuracy"
+    "income"
+    "inefficiency"
+    "inertia"
+    "infiltrating"
+    "infrared"
+    "inscrutable"
+    "installable"
+    "interest"
+    "interference"
+    "invisible"
+    "ion"
+    "jamming"
+    "job"
+    "jump"
+    "kill"
+    "label"
+    "landing"
+    "landscape"
+    "language"
+    "launch"
+    "leak"
+    "leakage"
+    "left"
+    "licenses"
+    "lifetime"
+    "link"
+    "live"
+    "location"
+    "log"
+    "maintenance"
+    "map"
+    "mappable"
+    "mass"
+    "message"
+    "minable"
+    "minables"
+    "minor"
+    "missile"
+    "modifier"
+    "mortgage"
+    "mounts"
+    "multiplier"
+    "music"
+    "name"
+    "names"
+    "near"
+    "neighbor"
+    "never"
+    "noun"
+    "npc"
+    "object"
+    "offer"
+    "offset"
+    "operating"
+    "optical"
+    "outfit"
+    "outfits"
+    "outfitter"
+    "over"
+    "overheat"
+    "override"
+    "parallel"
+    "passengers"
+    "payment"
+    "penalties"
+    "penalty"
+    "percentage"
+    "period"
+    "personality"
+    "phasing"
+    "piercing"
+    "planet"
+    "player"
+    "plural"
+    "portrait"
+    "ports"
+    "pos"
+    "power"
+    "principal"
+    "priority"
+    "protection"
+    "provoke"
+    "provoked"
+    "radar"
+    "radius"
+    "raid"
+    "ramscoop"
+    "random"
+    "range"
+    "rate"
+    "relative"
+    "reload"
+    "remove"
+    "repair"
+    "repeat"
+    "replace"
+    "reputation"
+    "require"
+    "required"
+    "resistance"
+    "reveal"
+    "reverse"
+    "rewind"
+    "right"
+    "safe"
+    "salaries"
+    "save"
+    "scale"
+    "scaling"
+    "scan"
+    "scene"
+    "score"
+    "scram"
+    "scramble"
+    "security"
+    "self"
+    "sentence"
+    "set"
+    "shield"
+    "shields"
+    "ships"
+    "shipyard"
+    "show"
+    "slowing"
+    "solar"
+    "sound"
+    "source"
+    "space"
+    "spaceport"
+    "spawn"
+    "speed"
+    "spin"
+    "split"
+    "sprite"
+    "star"
+    "starfield"
+    "stealth"
+    "steering"
+    "stopover"
+    "stream"
+    "strength"
+    "submunition"
+    "substitutions"
+    "swizzle"
+    "system"
+    "system-wide"
+    "tactical"
+    "target"
+    "term"
+    "threshold"
+    "thrust"
+    "thrusting"
+    "thumbnail"
+    "time"
+    "toward"
+    "tracking"
+    "tribute"
+    "trigger"
+    "turn"
+    "turning"
+    "turret"
+    "uncapturable"
+    "under"
+    "universal"
+    "unlink"
+    "unplunderable"
+    "unvisit"
+    "variant"
+    "velocity"
+    "visit"
+    "waypoint"
+    "weapon"
+    "wind"
+    "word"
+    "wormhole"
+    "zoom"
+    ))
+
+(defvar endless-sky-keywords
+  '(
+    "no"
+    "on"
+    "to"
+    "in"
+    "out"
+    "not"
+    "has"
+    "for"
+    "if"
+    "and"
+    "or"
+    "never"
+    ))
+
+
+(defvar endless-sky-font-lock-defaults
+  `((
+     ;; stuff between double quotes and backticks
+     ;; ("\"\\.\\*\\?" . font-lock-string-face)
+     ("\`\\.\\*\\?\`" . font-lock-string-face)
+     ;; ; : , ; { } =>  @ $ = are all special elements
+     (":\\|,\\|;\\|{\\|}\\|=>\\|@\\|$\\|=" . font-lock-keyword-face)
+     ( ,(regexp-opt endless-sky-keywords 'words) . font-lock-keyword-face)
+     ( ,(regexp-opt endless-sky-builtins 'words) . font-lock-builtin-face)
+     ( ,(regexp-opt endless-sky-constants 'words) . font-lock-constant-face)
+     )))
+  
+(define-derived-mode endless-sky-mode fundamental-mode "Endless Sky data"
+  "A major mode for editing Endless Sky data files"
+
+  (setq font-lock-defaults endless-sky-font-lock-defaults)
+
+  (setq comment-start "#")
+  (setq comment-end "")
+
+  (modify-syntax-entry ?# "< b" endless-sky-mode-syntax-table)
+  (modify-syntax-entry ?\n "> b" endless-sky-mode-syntax-table)
+
+  (define-key endless-sky-mode-map (kbd "TAB") 'self-insert-command))
+
+(provide 'endless-sky-mode)
+