Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
nqc.vim366 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:	NQC - Not Quite C, for LEGO mindstorms3"		NQC homepage: http://www.enteract.com/~dbaum/nqc/4" Maintainer:	Stefan Scherer <stefan@enotes.de>5" Last Change:	2001 May 106" URL:		http://www.enotes.de/twiki/pub/Home/LegoMindstorms/nqc.vim7" Filenames:	.nqc8 9" quit when a syntax file was already loaded10if exists("b:current_syntax")11  finish12endif13 14" Statements15syn keyword	nqcStatement	break return continue start stop abs sign16syn keyword     nqcStatement	sub task17syn keyword     nqcLabel	case default18syn keyword	nqcConditional	if else switch19syn keyword	nqcRepeat	while for do until repeat20 21" Scout and RCX222syn keyword	nqcEvents	acquire catch monitor23 24" types and classes25syn keyword	nqcType		int true false void26syn keyword	nqcStorageClass	asm const inline27 28 29 30" Sensors --------------------------------------------31" Input Sensors32syn keyword     nqcConstant	SENSOR_1 SENSOR_2 SENSOR_333 34" Types for SetSensorType()35syn keyword     nqcConstant	SENSOR_TYPE_TOUCH SENSOR_TYPE_TEMPERATURE36syn keyword     nqcConstant	SENSOR_TYPE_LIGHT SENSOR_TYPE_ROTATION37syn keyword     nqcConstant	SENSOR_LIGHT SENSOR_TOUCH38 39" Modes for SetSensorMode()40syn keyword     nqcConstant	SENSOR_MODE_RAW SENSOR_MODE_BOOL41syn keyword     nqcConstant	SENSOR_MODE_EDGE SENSOR_MODE_PULSE42syn keyword     nqcConstant	SENSOR_MODE_PERCENT SENSOR_MODE_CELSIUS43syn keyword     nqcConstant	SENSOR_MODE_FAHRENHEIT SENSOR_MODE_ROTATION44 45" Sensor configurations for SetSensor()46syn keyword     nqcConstant	SENSOR_TOUCH SENSOR_LIGHT SENSOR_ROTATION47syn keyword     nqcConstant	SENSOR_CELSIUS SENSOR_FAHRENHEIT SENSOR_PULSE48syn keyword     nqcConstant	SENSOR_EDGE49 50" Functions - All51syn keyword	nqcFunction	ClearSensor52syn keyword	nqcFunction	SensorValue SensorType53 54" Functions - RCX55syn keyword	nqcFunction	SetSensor SetSensorType56syn keyword	nqcFunction	SensorValueBool57 58" Functions - RCX, CyberMaster59syn keyword	nqcFunction	SetSensorMode SensorMode60 61" Functions - RCX, Scout62syn keyword	nqcFunction	SensorValueRaw63 64" Functions - Scout65syn keyword	nqcFunction	SetSensorLowerLimit SetSensorUpperLimit66syn keyword	nqcFunction	SetSensorHysteresis CalibrateSensor67 68 69" Outputs --------------------------------------------70" Outputs for On(), Off(), etc.71syn keyword     nqcConstant	OUT_A OUT_B OUT_C72 73" Modes for SetOutput()74syn keyword     nqcConstant	OUT_ON OUT_OFF OUT_FLOAT75 76" Directions for SetDirection()77syn keyword     nqcConstant	OUT_FWD OUT_REV OUT_TOGGLE78 79" Output power for SetPower()80syn keyword     nqcConstant	OUT_LOW OUT_HALF OUT_FULL81 82" Functions - All83syn keyword	nqcFunction	SetOutput SetDirection SetPower OutputStatus84syn keyword	nqcFunction	On Off Float Fwd Rev Toggle85syn keyword	nqcFunction	OnFwd OnRev OnFor86 87" Functions - RXC2, Scout88syn keyword	nqcFunction	SetGlobalOutput SetGlobalDirection SetMaxPower89syn keyword	nqcFunction	GlobalOutputStatus90 91 92" Sound ----------------------------------------------93" Sounds for PlaySound()94syn keyword     nqcConstant	SOUND_CLICK SOUND_DOUBLE_BEEP SOUND_DOWN95syn keyword     nqcConstant	SOUND_UP SOUND_LOW_BEEP SOUND_FAST_UP96 97" Functions - All98syn keyword	nqcFunction	PlaySound PlayTone99 100" Functions - RCX2, Scout101syn keyword	nqcFunction	MuteSound UnmuteSound ClearSound102syn keyword	nqcFunction	SelectSounds103 104 105" LCD ------------------------------------------------106" Modes for SelectDisplay()107syn keyword     nqcConstant	DISPLAY_WATCH DISPLAY_SENSOR_1 DISPLAY_SENSOR_2108syn keyword     nqcConstant	DISPLAY_SENSOR_3 DISPLAY_OUT_A DISPLAY_OUT_B109syn keyword     nqcConstant	DISPLAY_OUT_C110" RCX2111syn keyword     nqcConstant	DISPLAY_USER112 113" Functions - RCX114syn keyword	nqcFunction	SelectDisplay115" Functions - RCX2116syn keyword	nqcFunction	SetUserDisplay117 118 119" Communication --------------------------------------120" Messages - RCX, Scout ------------------------------121" Tx power level for SetTxPower()122syn keyword     nqcConstant	TX_POWER_LO TX_POWER_HI123 124" Functions - RCX, Scout125syn keyword	nqcFunction	Message ClearMessage SendMessage SetTxPower126 127" Serial - RCX2 --------------------------------------128" for SetSerialComm()129syn keyword     nqcConstant	SERIAL_COMM_DEFAULT SERIAL_COMM_4800130syn keyword     nqcConstant	SERIAL_COMM_DUTY25 SERIAL_COMM_76KHZ131 132" for SetSerialPacket()133syn keyword     nqcConstant	SERIAL_PACKET_DEFAULT SERIAL_PACKET_PREAMBLE134syn keyword     nqcConstant	SERIAL_PACKET_NEGATED SERIAL_PACKET_CHECKSUM135syn keyword     nqcConstant	SERIAL_PACKET_RCX136 137" Functions - RCX2138syn keyword	nqcFunction	SetSerialComm SetSerialPacket SetSerialData139syn keyword	nqcFunction	SerialData SendSerial140 141" VLL - Scout ----------------------------------------142" Functions - Scout143syn keyword	nqcFunction	SendVLL144 145 146" Timers ---------------------------------------------147" Functions - All148syn keyword	nqcFunction	ClearTimer Timer149 150" Functions - RCX2151syn keyword	nqcFunction	SetTimer FastTimer152 153 154" Counters -------------------------------------------155" Functions - RCX2, Scout156syn keyword	nqcFunction	ClearCounter IncCounter DecCounter Counter157 158 159" Access Control -------------------------------------160syn keyword     nqcConstant	ACQUIRE_OUT_A ACQUIRE_OUT_B ACQUIRE_OUT_C161syn keyword     nqcConstant	ACQUIRE_SOUND162" RCX2 only163syn keyword     nqcConstant	ACQUIRE_USER_1 ACQUIRE_USER_2 ACQUIRE_USER_3164syn keyword     nqcConstant	ACQUIRE_USER_4165 166" Functions - RCX2, Scout167syn keyword	nqcFunction	SetPriority168 169 170" Events ---------------------------------------------171" RCX2 Events172syn keyword     nqcConstant	EVENT_TYPE_PRESSED EVENT_TYPE_RELEASED173syn keyword     nqcConstant	EVENT_TYPE_PULSE EVENT_TYPE_EDGE174syn keyword     nqcConstant	EVENT_TYPE_FAST_CHANGE EVENT_TYPE_LOW175syn keyword     nqcConstant	EVENT_TYPE_NORMAL EVENT_TYPE_HIGH176syn keyword     nqcConstant	EVENT_TYPE_CLICK EVENT_TYPE_DOUBLECLICK177syn keyword     nqcConstant	EVENT_TYPE_MESSAGE178 179" Scout Events180syn keyword     nqcConstant	EVENT_1_PRESSED EVENT_1_RELEASED181syn keyword     nqcConstant	EVENT_2_PRESSED EVENT_2_RELEASED182syn keyword     nqcConstant	EVENT_LIGHT_HIGH EVENT_LIGHT_NORMAL183syn keyword     nqcConstant	EVENT_LIGHT_LOW EVENT_LIGHT_CLICK184syn keyword     nqcConstant	EVENT_LIGHT_DOUBLECLICK EVENT_COUNTER_0185syn keyword     nqcConstant	EVENT_COUNTER_1 EVENT_TIMER_0 EVENT_TIMER_1186syn keyword     nqcConstant	EVENT_TIMER_2 EVENT_MESSAGE187 188" Functions - RCX2, Scout189syn keyword	nqcFunction	ActiveEvents Event190 191" Functions - RCX2192syn keyword	nqcFunction	CurrentEvents193syn keyword	nqcFunction	SetEvent ClearEvent ClearAllEvents EventState194syn keyword	nqcFunction	CalibrateEvent SetUpperLimit UpperLimit195syn keyword	nqcFunction	SetLowerLimit LowerLimit SetHysteresis196syn keyword	nqcFunction	Hysteresis197syn keyword	nqcFunction	SetClickTime ClickTime SetClickCounter198syn keyword	nqcFunction	ClickCounter199 200" Functions - Scout201syn keyword	nqcFunction	SetSensorClickTime SetCounterLimit202syn keyword	nqcFunction	SetTimerLimit203 204 205" Data Logging ---------------------------------------206" Functions - RCX207syn keyword	nqcFunction	CreateDatalog AddToDatalog208syn keyword	nqcFunction	UploadDatalog209 210 211" General Features -----------------------------------212" Functions - All213syn keyword	nqcFunction	Wait StopAllTasks Random214syn keyword	nqcFunction	SetSleepTime SleepNow215 216" Functions - RCX217syn keyword	nqcFunction	Program Watch SetWatch218 219" Functions - RCX2220syn keyword	nqcFunction	SetRandomSeed SelectProgram221syn keyword	nqcFunction	BatteryLevel FirmwareVersion222 223" Functions - Scout224" Parameters for SetLight()225syn keyword     nqcConstant	LIGHT_ON LIGHT_OFF226syn keyword	nqcFunction	SetScoutRules ScoutRules SetScoutMode227syn keyword	nqcFunction	SetEventFeedback EventFeedback SetLight228 229" additional CyberMaster defines230syn keyword     nqcConstant	OUT_L OUT_R OUT_X231syn keyword     nqcConstant	SENSOR_L SENSOR_M SENSOR_R232" Functions - CyberMaster233syn keyword	nqcFunction	Drive OnWait OnWaitDifferent234syn keyword	nqcFunction	ClearTachoCounter TachoCount TachoSpeed235syn keyword	nqcFunction	ExternalMotorRunning AGC236 237 238 239" nqcCommentGroup allows adding matches for special things in comments240syn keyword	nqcTodo		contained TODO FIXME XXX241syn cluster	nqcCommentGroup	contains=nqcTodo242 243"when wanted, highlight trailing white space244if exists("nqc_space_errors")245  if !exists("nqc_no_trail_space_error")246    syn match	nqcSpaceError	display excludenl "\s\+$"247  endif248  if !exists("nqc_no_tab_space_error")249    syn match	nqcSpaceError	display " \+\t"me=e-1250  endif251endif252 253"catch errors caused by wrong parenthesis and brackets254syn cluster	nqcParenGroup	contains=nqcParenError,nqcIncluded,nqcCommentSkip,@nqcCommentGroup,nqcCommentStartError,nqcCommentSkip,nqcCppOut,nqcCppOut2,nqcCppSkip,nqcNumber,nqcFloat,nqcNumbers255if exists("nqc_no_bracket_error")256  syn region	nqcParen	transparent start='(' end=')' contains=ALLBUT,@nqcParenGroup,nqcCppParen257  " nqcCppParen: same as nqcParen but ends at end-of-line; used in nqcDefine258  syn region	nqcCppParen	transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@nqcParenGroup,nqcParen259  syn match	nqcParenError	display ")"260  syn match	nqcErrInParen	display contained "[{}]"261else262  syn region	nqcParen		transparent start='(' end=')' contains=ALLBUT,@nqcParenGroup,nqcCppParen,nqcErrInBracket,nqcCppBracket263  " nqcCppParen: same as nqcParen but ends at end-of-line; used in nqcDefine264  syn region	nqcCppParen	transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@nqcParenGroup,nqcErrInBracket,nqcParen,nqcBracket265  syn match	nqcParenError	display "[\])]"266  syn match	nqcErrInParen	display contained "[\]{}]"267  syn region	nqcBracket	transparent start='\[' end=']' contains=ALLBUT,@nqcParenGroup,nqcErrInParen,nqcCppParen,nqcCppBracket268  " nqcCppBracket: same as nqcParen but ends at end-of-line; used in nqcDefine269  syn region	nqcCppBracket	transparent start='\[' skip='\\$' excludenl end=']' end='$' contained contains=ALLBUT,@nqcParenGroup,nqcErrInParen,nqcParen,nqcBracket270  syn match	nqcErrInBracket	display contained "[);{}]"271endif272 273"integer number, or floating point number without a dot and with "f".274syn case ignore275syn match	nqcNumbers	display transparent "\<\d\|\.\d" contains=nqcNumber,nqcFloat276" Same, but without octal error (for comments)277syn match	nqcNumber	display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"278"hex number279syn match	nqcNumber	display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"280" Flag the first zero of an octal number as something special281syn match	nqcFloat	display contained "\d\+f"282"floating point number, with dot, optional exponent283syn match	nqcFloat	display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="284"floating point number, starting with a dot, optional exponent285syn match	nqcFloat	display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"286"floating point number, without dot, with exponent287syn match	nqcFloat	display contained "\d\+e[-+]\=\d\+[fl]\=\>"288" flag an octal number with wrong digits289syn case match290 291syn region	nqcCommentL	start="//" skip="\\$" end="$" keepend contains=@nqcCommentGroup,nqcSpaceError292syn region	nqcComment	matchgroup=nqcCommentStart start="/\*" matchgroup=NONE end="\*/" contains=@nqcCommentGroup,nqcCommentStartError,nqcSpaceError293 294" keep a // comment separately, it terminates a preproc. conditional295syntax match	nqcCommentError	display "\*/"296syntax match	nqcCommentStartError display "/\*" contained297 298 299 300 301 302syn region	nqcPreCondit	start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=nqcComment,nqcCharacter,nqcCppParen,nqcParenError,nqcNumbers,nqcCommentError,nqcSpaceError303syn match	nqcPreCondit	display "^\s*#\s*\(else\|endif\)\>"304if !exists("nqc_no_if0")305  syn region	nqcCppOut		start="^\s*#\s*if\s\+0\>" end=".\|$" contains=nqcCppOut2306  syn region	nqcCppOut2	contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=nqcSpaceError,nqcCppSkip307  syn region	nqcCppSkip	contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=nqcSpaceError,nqcCppSkip308endif309syn region	nqcIncluded	display contained start=+"+ skip=+\\\\\|\\"+ end=+"+310syn match	nqcInclude	display "^\s*#\s*include\>\s*["]" contains=nqcIncluded311"syn match nqcLineSkip	"\\$"312syn cluster	nqcPreProcGroup	contains=nqcPreCondit,nqcIncluded,nqcInclude,nqcDefine,nqcErrInParen,nqcErrInBracket,nqcCppOut,nqcCppOut2,nqcCppSkip,nqcNumber,nqcFloat,nqcNumbers,nqcCommentSkip,@nqcCommentGroup,nqcCommentStartError,nqcParen,nqcBracket313syn region	nqcDefine	start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@nqcPreProcGroup314syn region	nqcPreProc	start="^\s*#\s*\(pragma\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@nqcPreProcGroup315 316if !exists("nqc_minlines")317  if !exists("nqc_no_if0")318    let nqc_minlines = 50	    " #if 0 constructs can be long319  else320    let nqc_minlines = 15	    " mostly for () constructs321  endif322endif323exec "syn sync ccomment nqcComment minlines=" . nqc_minlines324 325" Define the default highlighting.326" Only when an item doesn't have highlighting yet327 328" The default methods for highlighting.  Can be overridden later329hi def link nqcLabel		Label330hi def link nqcConditional		Conditional331hi def link nqcRepeat		Repeat332hi def link nqcCharacter		Character333hi def link nqcNumber		Number334hi def link nqcFloat		Float335hi def link nqcFunction		Function336hi def link nqcParenError		nqcError337hi def link nqcErrInParen		nqcError338hi def link nqcErrInBracket	nqcError339hi def link nqcCommentL		nqcComment340hi def link nqcCommentStart	nqcComment341hi def link nqcCommentError	nqcError342hi def link nqcCommentStartError	nqcError343hi def link nqcSpaceError		nqcError344hi def link nqcStorageClass	StorageClass345hi def link nqcInclude		Include346hi def link nqcPreProc		PreProc347hi def link nqcDefine		Macro348hi def link nqcIncluded		String349hi def link nqcError		Error350hi def link nqcStatement		Statement351hi def link nqcEvents		Statement352hi def link nqcPreCondit		PreCondit353hi def link nqcType		Type354hi def link nqcConstant		Constant355hi def link nqcCommentSkip		nqcComment356hi def link nqcComment		Comment357hi def link nqcTodo		Todo358hi def link nqcCppSkip		nqcCppOut359hi def link nqcCppOut2		nqcCppOut360hi def link nqcCppOut		Comment361 362 363let b:current_syntax = "nqc"364 365" vim: ts=8366 
codekingpro/portable-devtools · Team Ai