X Tutup
Skip to content

Commit 198f35a

Browse files
committed
sVB 3.1.1
1 parent b2da845 commit 198f35a

File tree

16 files changed

+461
-49
lines changed

16 files changed

+461
-49
lines changed

LangServices/CompilerService.vb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,10 +829,18 @@ Namespace Microsoft.SmallVisualBasic.LanguageService
829829
DummyCompiler.Compile(New TextBufferReader(buffer.CurrentSnapshot), True)
830830
Dim symbolTable = _compiler.Parser.SymbolTable
831831
symbolTable.ModuleNames = buffer.Properties.GetProperty(Of Dictionary(Of String, String))("ControlsInfo")
832-
symbolTable.ControlNames = buffer.Properties.GetProperty(Of List(Of String))("ControlNames")
832+
symbolTable.ControlNames = GetControlNames(buffer)
833833
Return symbolTable
834834
End Function
835835

836+
Friend Function GetControlNames(buffer As ITextBuffer) As List(Of String)
837+
Dim controlNames = buffer.Properties.GetProperty(Of List(Of String))("ControlNames")
838+
If controlNames Is Nothing Then Return New List(Of String)
839+
840+
Return (From name In controlNames
841+
Where name.ToLower() <> "graphicswindow").ToList()
842+
End Function
843+
836844
Public Function FindCurrentSubStart(textSnapshot As ITextSnapshot, LineNumber As Integer) As Integer
837845
For i = LineNumber To 0 Step -1
838846
Dim line = textSnapshot.GetLineFromLineNumber(i)

LangServices/CompletionKeyboardFilter.vb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Namespace Microsoft.SmallVisualBasic.LanguageService
9898
If textView.Properties.TryGetProperty(GetType(CompletionSurface), completionSurface) Then
9999
If completionSurface.IsAdornmentVisible Then
100100
Select Case args.Text
101-
Case "+", "-", "*", "/", "%"
101+
Case "&", "+", "-", "*", "/", "%"
102102
args.Handled = CommitConditionally(textView, completionSurface, " " & args.Text & " ")
103103

104104
Case "="
@@ -197,7 +197,9 @@ Namespace Microsoft.SmallVisualBasic.LanguageService
197197
If nextToken.Type = TokenType.LeftParens Then
198198
repWith = repWith.TrimEnd("("c, ")"c)
199199
ElseIf repWith.EndsWith("(") Then
200-
If nextToken.IsIllegal OrElse nextToken.ParseType = ParseType.Operator Then
200+
If nextToken.IsIllegal OrElse
201+
nextToken.ParseType = ParseType.Operator OrElse
202+
nextToken.ParseType = ParseType.Keyword Then
201203
If extraText <> ")" Then extraText &= ")"
202204
ElseIf extraText = ")" Then
203205
extraText = ""

LangServices/CompletionProvider.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ Namespace Microsoft.SmallVisualBasic.LanguageService
981981

982982
Dim properties = textBuffer.Properties
983983
Dim controlsInfo = properties.GetProperty(Of Dictionary(Of String, String))("ControlsInfo")
984-
Dim controlNames = properties.GetProperty(Of List(Of String))("ControlNames")
984+
Dim controlNames = GetControlNames(textBuffer)
985985
Dim tokens = LineScanner.GetTokens(line.GetText(), line.LineNumber)
986986
Dim lastIndex = tokens.Count - 1
987987
Dim prevToken As Token = Nothing
@@ -1383,7 +1383,7 @@ LineShow:
13831383
Dim especialItem = ""
13841384
Dim properties = textBuffer.Properties
13851385
Dim controlsInfo = properties.GetProperty(Of Dictionary(Of String, String))("ControlsInfo")
1386-
Dim controlNames = properties.GetProperty(Of List(Of String))("ControlNames")
1386+
Dim controlNames = GetControlNames(textBuffer)
13871387
Dim source = New TextBufferReader(line.TextSnapshot)
13881388
Dim gp = GlobalParser
13891389
Dim symbolTable = compHelper.Compile(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
GW.PenColor = Colors.Goldenrod
2+
A = 18
3+
B = 0.4
4+
C = 200
5+
N = 24
6+
W = 500
7+
Y = 50
8+
9+
For I = 10 To 500 Step 3
10+
X = C * (I / N - (I - A) / (N - B))
11+
GW.DrawLine(
12+
W - X, Y + I,
13+
W + X, Y + I
14+
)
15+
N = N - 0.1
16+
Next
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
3+
' ------------------------------------------------
4+
Sub Button1_OnClick()
5+
For number = 0 To 999
6+
code = Text.Repeat(0, 3 - Text.GetLength(number)) & number
7+
If Distinct(code) And
8+
Inplace(code, 682, 1) And
9+
Misplaced(code, 614, 1) And
10+
Misplaced(code, 206, 2) And
11+
Reject(code, 738) = False And
12+
Misplaced(code, 780, 1) Then
13+
Forms.ShowMessage("Code: " + code, "Message")
14+
EndIf
15+
Next
16+
EndSub
17+
18+
' ------------------------------------------------
19+
Function Distinct(code)
20+
Return code[1] <> code[2] And
21+
code[1] <> code[2] And
22+
code[2] <> code[3]
23+
EndFunction
24+
25+
' ------------------------------------------------
26+
Function Inplace(code, clue, count)
27+
n = 0
28+
For i = 1 To 3
29+
If code[i] = clue[i] Then
30+
n = n + 1
31+
EndIf
32+
Next
33+
Return n = count
34+
EndFunction
35+
36+
' ------------------------------------------------
37+
Function Misplaced(code, clue, count)
38+
n = 0
39+
For i = 1 To 3
40+
If code[i] = clue[i] Then
41+
Return False
42+
EndIf
43+
If Text.Contains(clue, code[i]) Then
44+
n = n + 1
45+
EndIf
46+
Next
47+
Return n = count
48+
EndFunction
49+
50+
51+
' ------------------------------------------------
52+
Function Reject(code, clue)
53+
ForEach digit In clue
54+
If Text.Contains(code, digit) Then
55+
Return True
56+
EndIf
57+
Next
58+
Return False
59+
EndFunction
60+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'@Form Hints:
2+
'#Form1{
3+
' Label1: Label
4+
' Button1: Button
5+
'}
6+
7+
Me = "form1"
8+
Label1 = "form1.label1"
9+
Button1 = "form1.button1"
10+
_path = Program.Directory + "\form1.xaml"
11+
Form1 = Forms.LoadForm("Form1", _path)
12+
Form.SetArgsArr(form1, Stack.PopValue("_form1_argsArr"))
13+
'#Events{
14+
' Button1: OnClick
15+
'}
16+
17+
' Button1 Events:
18+
Control.HandleEvents(Button1)
19+
Control.OnClick = Button1_OnClick
20+
21+
22+
Form.Show(Me)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Canvas Background="#FFF0F0F0" Name="Form1" Width="503.464566929132" Height="526.456692913387" FlowDirection="LeftToRight" AutomationProperties.HelpText="Form1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib"><Canvas.Tag><s:Boolean>False</s:Boolean></Canvas.Tag><Label Width="501.732283464566" Height="445.850393700787" Canvas.Left="0" Canvas.Top="0" AutomationProperties.Name="Label1"><Label.Background><ImageBrush ImageSource="\Puzzle.jpg" /></Label.Background><TextBlock TextWrapping="Wrap" /></Label><Button Width="170.07874015748" Height="45.3543307086614" Canvas.Left="166.299212598425" Canvas.Top="464.88188976378" AutomationProperties.Name="Button1" AutomationProperties.HelpText="Solve"><TextBlock Text="Solve" TextWrapping="Wrap" /></Button><Control Name="__FORM__PROPS__" Tag="{x:Null}" MinWidth="0" MaxWidth="Infinity" MinHeight="0" MaxHeight="Infinity" ToolTip="{x:Null}" Canvas.Left="Auto" Canvas.Top="Auto" /></Canvas>
27.1 KB
Loading

Samples/Turtle Samples/Adam.sb

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
Turtle.Speed = 50
2+
Turtle.Width = 24
3+
4+
' A
5+
Turtle.Turn(30)
6+
Turtle.Move(100)
7+
Turtle.Turn(120)
8+
Turtle.Move(45)
9+
Turtle.Turn(120)
10+
Turtle.Move(45)
11+
Turtle.Turn(180)
12+
Turtle.Move(45)
13+
Turtle.Turn(60)
14+
Turtle.Move(55)
15+
16+
' d
17+
Turtle.Turn(-60)
18+
Turtle.PenUp()
19+
Turtle.Move(30)
20+
Turtle.PenDown()
21+
Turtle.Move(50)
22+
Turtle.TurnLeft()
23+
Turtle.Move(100)
24+
Turtle.Turn(180)
25+
Turtle.Move(50)
26+
Turtle.TurnRight()
27+
Turtle.Move(50)
28+
Turtle.TurnLeft()
29+
Turtle.Move(50)
30+
31+
Turtle.PenUp()
32+
Turtle.TurnLeft()
33+
Turtle.Move(100)
34+
35+
' a
36+
Turtle.PenDown()
37+
Turtle.Move(30)
38+
Turtle.TurnLeft()
39+
Turtle.Move(60)
40+
Turtle.Turn(180)
41+
Turtle.Move(10)
42+
Turtle.TurnRight()
43+
Turtle.Move(50)
44+
Turtle.TurnLeft()
45+
Turtle.Move(50)
46+
Turtle.TurnLeft()
47+
Turtle.Move(60)
48+
Turtle.PenUp()
49+
Turtle.Move(20)
50+
51+
' m
52+
Turtle.PenDown()
53+
Turtle.TurnLeft()
54+
Turtle.Move(50)
55+
Turtle.TurnRight()
56+
Turtle.Move(25)
57+
Turtle.TurnRight()
58+
Turtle.Move(50)
59+
Turtle.Turn(180)
60+
Turtle.Move(50)
61+
Turtle.TurnRight()
62+
Turtle.Move(25)
63+
Turtle.TurnRight()
64+
Turtle.Move(50)

0 commit comments

Comments
 (0)
X Tutup