Hellou,
i have created syntax highlighting for Monkey language, and now i want make function list view with structure:
Import
Globals
Classes
- Fields
- Methods
Functions
.
I have define this here:
Maybe is something is wrong because, group Fields and Methods doesn't work and are not included under Group "classes", when i use:
out of group class, then all fields and methods are correctly readed.
Wordfile:
Test file:
Please help.
AndyGFX.
i have created syntax highlighting for Monkey language, and now i want make function list view with structure:
Import
Globals
Classes
- Fields
- Methods
Functions
.
I have define this here:
Code: Select all
/TGBegin "Classes"
/TGFindStr = "%Class^([ ^t]+[a-z_0-9.*]+^)"
/TGFindBStart = "Class"
/TGFindBEnd = "End Class"
/TGBegin "Fields"
/TGFindStr = "[ ^t]Field[ ^t]"
/TGEnd
/TGBegin "Methods"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)"
/TGFindStr = "[ ^t]++Method[ ^t]++New++"
/TGBegin "Argument"
/TGFindStr = "[ ^t^p]++^([~,]+^)"
/TGFindBStart = "("
/TGFindBEnd = ")"
/TGEnd
/TGBegin "Return"
/TGFindStr = "^([a-z]+^)"
/TGFindBStart = "Return"
/TGFindBEnd = "End"
/TGEnd
/TGEnd
/TGEnd
/TGBegin "Function"
/TGFindStr = "[ ^t]++Function[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)"
/TGFindStr = "[ ^t]++Function[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)"
/TGBegin "Argument"
/TGFindStr = "[ ^t^p]++^([~,]+^)"
/TGFindBStart = "("
/TGFindBEnd = ")"
/TGEnd
/TGBegin "Return"
/TGFindStr = "^([a-z]+^)"
/TGFindBStart = "Return"
/TGFindBEnd = "End"
/TGEnd
/TGEnd
Code: Select all
/TGBegin "Fields"
/TGFindStr = "[ ^t]Field[ ^t]"
/TGEnd
/TGBegin "Methods"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)"
/TGFindStr = "[ ^t]++Method[ ^t]++New++"
/TGBegin "Argument"
/TGFindStr = "[ ^t^p]++^([~,]+^)"
/TGFindBStart = "("
/TGFindBEnd = ")"
/TGEnd
/TGBegin "Return"
/TGFindStr = "^([a-z]+^)"
/TGFindBStart = "Return"
/TGFindBEnd = "End"
/TGEnd
/TGEnd
Wordfile:
Code: Select all
/L15"MONKEY" MONKEY_LANG Line Comment = ' Block Comment On = #Rem Block Comment Off = #End Escape Char = \ File Extensions = MONKEY
/TGBegin "Global"
/TGFindStr = "%Global[ ^t]"
/TGEnd
/TGBegin "Local"
/TGFindStr = "%Local[ ^t]"
/TGEnd
/TGBegin "Import"
/TGFindStr = "%Import^([ ^t]+[a-z0-9.*]+^)"
/TGEnd
/TGBegin "Classes"
/TGFindStr = "%Class^([ ^t]+[a-z_0-9.*]+^)"
/TGFindBStart = "Class"
/TGFindBEnd = "End Class"
/TGBegin "Fields"
/TGFindStr = "[ ^t]Field[ ^t]"
/TGEnd
/TGBegin "Methods"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)"
/TGFindStr = "[ ^t]++Method[ ^t]++New++"
/TGBegin "Argument"
/TGFindStr = "[ ^t^p]++^([~,]+^)"
/TGFindBStart = "("
/TGFindBEnd = ")"
/TGEnd
/TGBegin "Return"
/TGFindStr = "^([a-z]+^)"
/TGFindBStart = "Return"
/TGFindBEnd = "End"
/TGEnd
/TGEnd
/TGEnd
/TGBegin "Fields"
/TGFindStr = "[ ^t]Field[ ^t]"
/TGEnd
/TGBegin "Methods"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)"
/TGFindStr = "[ ^t]++Method[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)"
/TGFindStr = "[ ^t]++Method[ ^t]++New++"
/TGBegin "Argument"
/TGFindStr = "[ ^t^p]++^([~,]+^)"
/TGFindBStart = "("
/TGFindBEnd = ")"
/TGEnd
/TGBegin "Return"
/TGFindStr = "^([a-z]+^)"
/TGFindBStart = "Return"
/TGFindBEnd = "End"
/TGEnd
/TGEnd
/TGBegin "Function"
/TGFindStr = "[ ^t]++Function[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)[ ^t^p]++([^p*&:, ^t^[^]/*^-'=:&a-z_0-9./(!]++)"
/TGFindStr = "[ ^t]++Function[ ^t]++^([a-z_][a-z_0-9]++:[a-z_^~][a-z_0-9]++^)"
/TGBegin "Argument"
/TGFindStr = "[ ^t^p]++^([~,]+^)"
/TGFindBStart = "("
/TGFindBEnd = ")"
/TGEnd
/TGBegin "Return"
/TGFindStr = "^([a-z]+^)"
/TGFindBStart = "Return"
/TGFindBEnd = "End"
/TGEnd
/TGEnd
/Colors = 12632256,4259584,16711680,16744448,16711935,
/Colors Back = 16777215,16777215,16777215,16777215,16777215,
/Colors Auto Back = 1,1,1,1,1,
/Font Style = 0,1,1,0,0,
/Delimiters = ~!@%^&*()-+=|\/{}[]:;"'<> , .?
/Member String = "^([A-Za-z0-9_:.]+^)[ ^t*&]+$S[ ^t]++[(=);,]"
/Variable String = "^([A-Za-z0-9_:.]+^)[ ^t*&]+$S[ ^t]++[(=);,]"
/Indent Strings = "{"
/Unindent Strings = "}"
/Open Brace Strings = "("
/Close Brace Strings = ")"
/Open Fold Strings = "Function" "Method" "Class"
/Close Fold Strings = "End Function" "End Method" "End Class"
/C1"Keywords" STYLE_KEYWORD Colors = 33023 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 1
#End
#Else
#If
#Rem
Abstract
Bool
Case
Class
Else
ElseIf
End
Endif
Extends
Extern
False
Field
Float
For
Function
Global
If
Import
Int
Local
Method
Next
New
Private
Public
Repeat
Return
Select
Self
Step
Strict
String
Then
To
True
Void
WEnd
/C2"Classes" STYLE_FUNCTION Colors = 8421440 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 1
Abs
AccelX
AccelY
AccelZ
ACos
AddFirst
AddLast
ASin
ATan
ATan2
Ceil
Clamp
Class
Cls
Const
Contains
Cos
DeviceHeight
DeviceWidth
DrawCircle
DrawEllipse
DrawImage
DrawImageRect
DrawLine
DrawOval
DrawRect
DrawText
Eachin
EndsWith
Error
Find
FindLast
Floor
FromChar
Function
Get
GetAlpha
GetBlend
GetColor
GetFont
GetChar
GetMatrix
GetScissor
GrabImage
ChannelState
Join
JoyDown
JoyHit
KeyDown
KeyHit
Length
LoadImage
LoadSound
LoadState
LoadString
Log
Max
Method
Millisecs
Min
MouseDown
MouseHit
MouseX
MouseY
PlaySound
PopMatrix
Pow
PushMatrix
Remove
RemoveEach
Replace
Rnd
Rotate
SaveState
Scale
Select
SetAlpha
SetBlend
SetColor
SetFont
SetHandle
SetChannelPan
SetChannelRate
SetChannelVolume
SetMatrix
SetScissor
SetUpdateRate
Sgn
Shl
Shr
Sin
Split
Sqrt
StartsWith
StopChannel
Tan
TouchDown
TouchHit
TouchX
TouchY
Transform
Translate
Until
ValueForKey
Wend
While
/C3"Operators" STYLE_OPERATOR Colors = 33023 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 0
!
%
&
*
+
-
// /
<
=
>
^
|
~
/C4"Braces, comma, semicolon" Colors = 16777215 Colors Back = 16777215 Colors Auto Back = 1 Font Style = 1
(
)
,
;
[
]
{
}
Code: Select all
Strict
Import mojo
Import agfx
Function CreateFlashArrayFromFile:FlashArray<b2Vec2>(filename:String)
Local res:FlashArray<b2Vec2>= New FlashArray<b2Vec2>()
Local file:String = LoadString("shapes/"+filename)
If file.Length()=0 Then Error("Shape file: .data/shapes/"+filename+" doesn't exist!")
Local verts:String[] = file.Split("|")
For Local i:Int=0 to verts.Length()-1
Local coord:String[]=verts[i].Split(",")
Local x:Float = Float(coord[0])
Local y:Float = Float(coord[1])
res.Push(New b2Vec2(x,y))
Next
Return res
End Function
Class TPivot Extends TEntity
Field offset:TVector2
'|--------------------------------------------------------------------------------
'| Constructor
'|--------------------------------------------------------------------------------
Method New(n:String,x:Float=0, y:Float=0,w:Int=32,h:Int=32)
Self.name = n
Self.speed = 1.0
Self.position.Set(x,y)
Self.size.Set(w,h)
Self.visible = True
Self.rotation = 0
Self.radius = w/2
Self.offset = New TVector2(0,0)
Self.velocity = New TVector2(0,0)
Self.collision.Set(Self.position,Self.size,Self.radius)
End Method
'|--------------------------------------------------------------------------------
'| UPDATE
'|--------------------------------------------------------------------------------
Method Update:Void()
Self.collision.UpdateByCenter(Self.position)
End Method
'|--------------------------------------------------------------------------------
'| DRAW (add inside OnRender)
'|--------------------------------------------------------------------------------
Method Draw:Void()
If DEBUG
SetColor 255, 255, 0
' collision shape
SetAlpha 0.15
SetColor 255,255,255
Self.collision.DebugDraw_Corners()
SetAlpha 1
' direction
SetColor(0,255,0)
DrawLine( Self.position.x+Self.offset.x,
Self.position.y+Self.offset.y,
Self.position.x+Self.offset.x+Self.direction.x*32,
Self.position.y+Self.offset.y+Self.direction.y*32)
' center
DrawCircle( Self.position.x + Self.offset.x ,
Self.position.y + Self.offset.y ,2)
' inner circle
SetAlpha 0.5
SetColor(255,255,0)
DrawCircle( Self.position.x + Self.offset.x , Self.position.y + Self.offset.y ,Self.radius)
SetColor(255,255,255)
SetAlpha 1
' collision radius
SetColor(255,0,0)
SetAlpha 0.5
DrawCircle( Self.position.x + Self.offset.x , Self.position.y + Self.offset.y ,Self.collision.radius)
SetColor(255,255,255)
SetAlpha 1
' collision square
Self.collision.DebugDraw_Corners()
'SetAlpha 0.5
'SetColor(255,0,0)
'DrawRectOutline(Self.collision.A.x + Self.offset.x , Self.collision.A.y + Self.offset.y ,Self.collision.size.x,Self.collision.size.y)
SetColor(255,255,255)
SetAlpha 1
'CONSOLE.fnt._DrawText("POS :" + Self.position.ToString(),Self.position.x-Self.size.x/2,Self.position.y+Self.size.y)
'CONSOLE.fnt._DrawText("DIR :" + Self.direction.ToString(),Self.position.x-Self.size.x/2,Self.position.y+Self.size.y+10)
'CONSOLE.fnt._DrawText("ANG :" + FormatNumber(Self.rotation),Self.position.x-Self.size.x/2,Self.position.y+Self.size.y+20)
'CONSOLE.fnt._DrawText("[" + Self.name+"]",Self.position.x-Self.size.x/2,Self.position.y+Self.size.y+30)
EndIf
End Method
End Class
AndyGFX.