?? nqc.vim
字號:
" Vim syntax file" Language: NQC - Not Quite C, for LEGO mindstorms" NQC homepage: http://www.enteract.com/~dbaum/nqc/" Maintainer: Stefan Scherer <stefan@enotes.de>" Last Change: 2001 May 10" URL: http://www.enotes.de/twiki/pub/Home/LegoMindstorms/nqc.vim" Filenames: .nqc" For version 5.x: Clear all syntax items" For version 6.x: Quit when a syntax file was already loadedif version < 600 syntax clearelseif exists("b:current_syntax") finishendif" Statementssyn keyword nqcStatement break return continue start stop abs signsyn keyword nqcStatement sub tasksyn keyword nqcLabel case defaultsyn keyword nqcConditional if else switchsyn keyword nqcRepeat while for do until repeat" Scout and RCX2syn keyword nqcEvents acquire catch monitor" types and classessyn keyword nqcType int true false voidsyn keyword nqcStorageClass asm const inline" Sensors --------------------------------------------" Input Sensorssyn keyword nqcConstant SENSOR_1 SENSOR_2 SENSOR_3" Types for SetSensorType()syn keyword nqcConstant SENSOR_TYPE_TOUCH SENSOR_TYPE_TEMPERATUREsyn keyword nqcConstant SENSOR_TYPE_LIGHT SENSOR_TYPE_ROTATIONsyn keyword nqcConstant SENSOR_LIGHT SENSOR_TOUCH" Modes for SetSensorMode()syn keyword nqcConstant SENSOR_MODE_RAW SENSOR_MODE_BOOLsyn keyword nqcConstant SENSOR_MODE_EDGE SENSOR_MODE_PULSEsyn keyword nqcConstant SENSOR_MODE_PERCENT SENSOR_MODE_CELSIUSsyn keyword nqcConstant SENSOR_MODE_FAHRENHEIT SENSOR_MODE_ROTATION" Sensor configurations for SetSensor()syn keyword nqcConstant SENSOR_TOUCH SENSOR_LIGHT SENSOR_ROTATIONsyn keyword nqcConstant SENSOR_CELSIUS SENSOR_FAHRENHEIT SENSOR_PULSEsyn keyword nqcConstant SENSOR_EDGE" Functions - Allsyn keyword nqcFunction ClearSensorsyn keyword nqcFunction SensorValue SensorType" Functions - RCXsyn keyword nqcFunction SetSensor SetSensorTypesyn keyword nqcFunction SensorValueBool" Functions - RCX, CyberMastersyn keyword nqcFunction SetSensorMode SensorMode" Functions - RCX, Scoutsyn keyword nqcFunction SensorValueRaw" Functions - Scoutsyn keyword nqcFunction SetSensorLowerLimit SetSensorUpperLimitsyn keyword nqcFunction SetSensorHysteresis CalibrateSensor" Outputs --------------------------------------------" Outputs for On(), Off(), etc.syn keyword nqcConstant OUT_A OUT_B OUT_C" Modes for SetOutput()syn keyword nqcConstant OUT_ON OUT_OFF OUT_FLOAT" Directions for SetDirection()syn keyword nqcConstant OUT_FWD OUT_REV OUT_TOGGLE" Output power for SetPower()syn keyword nqcConstant OUT_LOW OUT_HALF OUT_FULL" Functions - Allsyn keyword nqcFunction SetOutput SetDirection SetPower OutputStatussyn keyword nqcFunction On Off Float Fwd Rev Togglesyn keyword nqcFunction OnFwd OnRev OnFor" Functions - RXC2, Scoutsyn keyword nqcFunction SetGlobalOutput SetGlobalDirection SetMaxPowersyn keyword nqcFunction GlobalOutputStatus" Sound ----------------------------------------------" Sounds for PlaySound()syn keyword nqcConstant SOUND_CLICK SOUND_DOUBLE_BEEP SOUND_DOWNsyn keyword nqcConstant SOUND_UP SOUND_LOW_BEEP SOUND_FAST_UP" Functions - Allsyn keyword nqcFunction PlaySound PlayTone" Functions - RCX2, Scoutsyn keyword nqcFunction MuteSound UnmuteSound ClearSoundsyn keyword nqcFunction SelectSounds" LCD ------------------------------------------------" Modes for SelectDisplay()syn keyword nqcConstant DISPLAY_WATCH DISPLAY_SENSOR_1 DISPLAY_SENSOR_2syn keyword nqcConstant DISPLAY_SENSOR_3 DISPLAY_OUT_A DISPLAY_OUT_Bsyn keyword nqcConstant DISPLAY_OUT_C" RCX2syn keyword nqcConstant DISPLAY_USER" Functions - RCXsyn keyword nqcFunction SelectDisplay" Functions - RCX2syn keyword nqcFunction SetUserDisplay" Communication --------------------------------------" Messages - RCX, Scout ------------------------------" Tx power level for SetTxPower()syn keyword nqcConstant TX_POWER_LO TX_POWER_HI" Functions - RCX, Scoutsyn keyword nqcFunction Message ClearMessage SendMessage SetTxPower" Serial - RCX2 --------------------------------------" for SetSerialComm()syn keyword nqcConstant SERIAL_COMM_DEFAULT SERIAL_COMM_4800syn keyword nqcConstant SERIAL_COMM_DUTY25 SERIAL_COMM_76KHZ" for SetSerialPacket()syn keyword nqcConstant SERIAL_PACKET_DEFAULT SERIAL_PACKET_PREAMBLEsyn keyword nqcConstant SERIAL_PACKET_NEGATED SERIAL_PACKET_CHECKSUMsyn keyword nqcConstant SERIAL_PACKET_RCX" Functions - RCX2syn keyword nqcFunction SetSerialComm SetSerialPacket SetSerialDatasyn keyword nqcFunction SerialData SendSerial" VLL - Scout ----------------------------------------" Functions - Scoutsyn keyword nqcFunction SendVLL" Timers ---------------------------------------------" Functions - Allsyn keyword nqcFunction ClearTimer Timer" Functions - RCX2syn keyword nqcFunction SetTimer FastTimer" Counters -------------------------------------------" Functions - RCX2, Scoutsyn keyword nqcFunction ClearCounter IncCounter DecCounter Counter" Access Control -------------------------------------syn keyword nqcConstant ACQUIRE_OUT_A ACQUIRE_OUT_B ACQUIRE_OUT_Csyn keyword nqcConstant ACQUIRE_SOUND" RCX2 onlysyn keyword nqcConstant ACQUIRE_USER_1 ACQUIRE_USER_2 ACQUIRE_USER_3syn keyword nqcConstant ACQUIRE_USER_4" Functions - RCX2, Scoutsyn keyword nqcFunction SetPriority" Events ---------------------------------------------" RCX2 Eventssyn keyword nqcConstant EVENT_TYPE_PRESSED EVENT_TYPE_RELEASEDsyn keyword nqcConstant EVENT_TYPE_PULSE EVENT_TYPE_EDGEsyn keyword nqcConstant EVENT_TYPE_FAST_CHANGE EVENT_TYPE_LOWsyn keyword nqcConstant EVENT_TYPE_NORMAL EVENT_TYPE_HIGHsyn keyword nqcConstant EVENT_TYPE_CLICK EVENT_TYPE_DOUBLECLICKsyn keyword nqcConstant EVENT_TYPE_MESSAGE" Scout Eventssyn keyword nqcConstant EVENT_1_PRESSED EVENT_1_RELEASEDsyn keyword nqcConstant EVENT_2_PRESSED EVENT_2_RELEASEDsyn keyword nqcConstant EVENT_LIGHT_HIGH EVENT_LIGHT_NORMALsyn keyword nqcConstant EVENT_LIGHT_LOW EVENT_LIGHT_CLICKsyn keyword nqcConstant EVENT_LIGHT_DOUBLECLICK EVENT_COUNTER_0syn keyword nqcConstant EVENT_COUNTER_1 EVENT_TIMER_0 EVENT_TIMER_1syn keyword nqcConstant EVENT_TIMER_2 EVENT_MESSAGE" Functions - RCX2, Scoutsyn keyword nqcFunction ActiveEvents Event" Functions - RCX2syn keyword nqcFunction CurrentEventssyn keyword nqcFunction SetEvent ClearEvent ClearAllEvents EventStatesyn keyword nqcFunction CalibrateEvent SetUpperLimit UpperLimitsyn keyword nqcFunction SetLowerLimit LowerLimit SetHysteresissyn keyword nqcFunction Hysteresissyn keyword nqcFunction SetClickTime ClickTime SetClickCountersyn keyword nqcFunction ClickCounter" Functions - Scoutsyn keyword nqcFunction SetSensorClickTime SetCounterLimitsyn keyword nqcFunction SetTimerLimit" Data Logging ---------------------------------------" Functions - RCXsyn keyword nqcFunction CreateDatalog AddToDatalogsyn keyword nqcFunction UploadDatalog" General Features -----------------------------------" Functions - Allsyn keyword nqcFunction Wait StopAllTasks Randomsyn keyword nqcFunction SetSleepTime SleepNow" Functions - RCXsyn keyword nqcFunction Program Watch SetWatch" Functions - RCX2syn keyword nqcFunction SetRandomSeed SelectProgramsyn keyword nqcFunction BatteryLevel FirmwareVersion" Functions - Scout" Parameters for SetLight()syn keyword nqcConstant LIGHT_ON LIGHT_OFFsyn keyword nqcFunction SetScoutRules ScoutRules SetScoutModesyn keyword nqcFunction SetEventFeedback EventFeedback SetLight" additional CyberMaster definessyn keyword nqcConstant OUT_L OUT_R OUT_Xsyn keyword nqcConstant SENSOR_L SENSOR_M SENSOR_R" Functions - CyberMastersyn keyword nqcFunction Drive OnWait OnWaitDifferentsyn keyword nqcFunction ClearTachoCounter TachoCount TachoSpeedsyn keyword nqcFunction ExternalMotorRunning AGC" nqcCommentGroup allows adding matches for special things in commentssyn keyword nqcTodo contained TODO FIXME XXXsyn cluster nqcCommentGroup contains=nqcTodo"when wanted, highlight trailing white spaceif exists("nqc_space_errors") if !exists("nqc_no_trail_space_error") syn match nqcSpaceError display excludenl "\s\+$" endif if !exists("nqc_no_tab_space_error") syn match nqcSpaceError display " \+\t"me=e-1 endifendif"catch errors caused by wrong parenthesis and bracketssyn cluster nqcParenGroup contains=nqcParenError,nqcIncluded,nqcCommentSkip,@nqcCommentGroup,nqcCommentStartError,nqcCommentSkip,nqcCppOut,nqcCppOut2,nqcCppSkip,nqcNumber,nqcFloat,nqcNumbersif exists("nqc_no_bracket_error") syn region nqcParen transparent start='(' end=')' contains=ALLBUT,@nqcParenGroup,nqcCppParen " nqcCppParen: same as nqcParen but ends at end-of-line; used in nqcDefine syn region nqcCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@nqcParenGroup,nqcParen syn match nqcParenError display ")" syn match nqcErrInParen display contained "[{}]"else syn region nqcParen transparent start='(' end=')' contains=ALLBUT,@nqcParenGroup,nqcCppParen,nqcErrInBracket,nqcCppBracket " nqcCppParen: same as nqcParen but ends at end-of-line; used in nqcDefine syn region nqcCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@nqcParenGroup,nqcErrInBracket,nqcParen,nqcBracket syn match nqcParenError display "[\])]" syn match nqcErrInParen display contained "[\]{}]" syn region nqcBracket transparent start='\[' end=']' contains=ALLBUT,@nqcParenGroup,nqcErrInParen,nqcCppParen,nqcCppBracket " nqcCppBracket: same as nqcParen but ends at end-of-line; used in nqcDefine syn region nqcCppBracket transparent start='\[' skip='\\$' excludenl end=']' end='$' contained contains=ALLBUT,@nqcParenGroup,nqcErrInParen,nqcParen,nqcBracket syn match nqcErrInBracket display contained "[);{}]"endif"integer number, or floating point number without a dot and with "f".syn case ignoresyn match nqcNumbers display transparent "\<\d\|\.\d" contains=nqcNumber,nqcFloat" Same, but without octal error (for comments)syn match nqcNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>""hex numbersyn match nqcNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"" Flag the first zero of an octal number as something specialsyn match nqcFloat display contained "\d\+f""floating point number, with dot, optional exponentsyn match nqcFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=""floating point number, starting with a dot, optional exponentsyn match nqcFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>""floating point number, without dot, with exponentsyn match nqcFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"" flag an octal number with wrong digitssyn case matchsyn region nqcCommentL start="//" skip="\\$" end="$" keepend contains=@nqcCommentGroup,nqcSpaceErrorsyn region nqcComment matchgroup=nqcCommentStart start="/\*" matchgroup=NONE end="\*/" contains=@nqcCommentGroup,nqcCommentStartError,nqcSpaceError" keep a // comment separately, it terminates a preproc. conditionalsyntax match nqcCommentError display "\*/"syntax match nqcCommentStartError display "/\*" containedsyn region nqcPreCondit start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=nqcComment,nqcCharacter,nqcCppParen,nqcParenError,nqcNumbers,nqcCommentError,nqcSpaceErrorsyn match nqcPreCondit display "^\s*#\s*\(else\|endif\)\>"if !exists("nqc_no_if0") syn region nqcCppOut start="^\s*#\s*if\s\+0\>" end=".\|$" contains=nqcCppOut2 syn region nqcCppOut2 contained start="0" end="^\s*#\s*\(endif\>\|else\>\|elif\>\)" contains=nqcSpaceError,nqcCppSkip syn region nqcCppSkip contained start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*#\s*endif\>" contains=nqcSpaceError,nqcCppSkipendifsyn region nqcIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+syn match nqcInclude display "^\s*#\s*include\>\s*["]" contains=nqcIncluded"syn match nqcLineSkip "\\$"syn cluster nqcPreProcGroup contains=nqcPreCondit,nqcIncluded,nqcInclude,nqcDefine,nqcErrInParen,nqcErrInBracket,nqcCppOut,nqcCppOut2,nqcCppSkip,nqcNumber,nqcFloat,nqcNumbers,nqcCommentSkip,@nqcCommentGroup,nqcCommentStartError,nqcParen,nqcBracketsyn region nqcDefine start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@nqcPreProcGroupsyn region nqcPreProc start="^\s*#\s*\(pragma\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@nqcPreProcGroupif !exists("nqc_minlines") if !exists("nqc_no_if0") let nqc_minlines = 50 " #if 0 constructs can be long else let nqc_minlines = 15 " mostly for () constructs endifendifexec "syn sync ccomment nqcComment minlines=" . nqc_minlines" Define the default highlighting." For version 5.7 and earlier: only when not done already" For version 5.8 and later: only when an item doesn't have highlighting yetif version >= 508 || !exists("did_nqc_syn_inits") if version < 508 let did_nqc_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif " The default methods for highlighting. Can be overridden later HiLink nqcLabel Label HiLink nqcConditional Conditional HiLink nqcRepeat Repeat HiLink nqcCharacter Character HiLink nqcNumber Number HiLink nqcFloat Float HiLink nqcFunction Function HiLink nqcParenError nqcError HiLink nqcErrInParen nqcError HiLink nqcErrInBracket nqcError HiLink nqcCommentL nqcComment HiLink nqcCommentStart nqcComment HiLink nqcCommentError nqcError HiLink nqcCommentStartError nqcError HiLink nqcSpaceError nqcError HiLink nqcStorageClass StorageClass HiLink nqcInclude Include HiLink nqcPreProc PreProc HiLink nqcDefine Macro HiLink nqcIncluded String HiLink nqcError Error HiLink nqcStatement Statement HiLink nqcEvents Statement HiLink nqcPreCondit PreCondit HiLink nqcType Type HiLink nqcConstant Constant HiLink nqcCommentSkip nqcComment HiLink nqcComment Comment HiLink nqcTodo Todo HiLink nqcCppSkip nqcCppOut HiLink nqcCppOut2 nqcCppOut HiLink nqcCppOut Comment delcommand HiLinkendiflet b:current_syntax = "nqc"" vim: ts=8
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -