mirror of
https://github.com/Ed94/LangStudies.git
synced 2025-01-22 04:23:45 -08:00
Added support for comments.
This commit is contained in:
parent
31f1ae9b8f
commit
856a1faa9c
@ -26,8 +26,10 @@ margin_left = 1.2
|
||||
margin_right = 0.375977
|
||||
grow_horizontal = 0
|
||||
theme = ExtResource( 2 )
|
||||
readonly = true
|
||||
highlight_current_line = true
|
||||
show_line_numbers = true
|
||||
wrap_enabled = true
|
||||
|
||||
[node name="SRegEx_TEdit" type="TextEdit" parent="."]
|
||||
anchor_left = 0.525
|
||||
|
@ -146,3 +146,27 @@ start \" !set( \" ).repeat(0-) \"
|
||||
start "null"
|
||||
start "this"
|
||||
start word.repeat(1-)
|
||||
|
||||
start(
|
||||
http://www\.
|
||||
| https://www\.
|
||||
| http://
|
||||
| https://
|
||||
).repeat(0-1)
|
||||
|
||||
set(a-z 0-9).repeat(1-)
|
||||
|
||||
(
|
||||
set(\- \. ).repeat(1)
|
||||
set(a-z 0-9).repeat(1-)
|
||||
)
|
||||
.repeat(0-)
|
||||
|
||||
\.
|
||||
|
||||
set(a-z).repeat(2,5)
|
||||
|
||||
( : set(0-9).repeat(1-5) ).repeat(0-1)
|
||||
|
||||
( / \. \*).repeat(0-1)
|
||||
end
|
@ -15,6 +15,7 @@ extends Object
|
||||
const TokenType : Dictionary = \
|
||||
{
|
||||
fmt_S = "Formatting",
|
||||
cmt_SL = "Comment Single Line",
|
||||
|
||||
str_start = "String Start",
|
||||
str_end = "String End",
|
||||
@ -55,6 +56,7 @@ const TokenType : Dictionary = \
|
||||
const Spec : Dictionary = \
|
||||
{
|
||||
TokenType.fmt_S : "^\\s",
|
||||
TokenType.cmt_SL: "^^\\(\\?\\#.*?\\)",
|
||||
|
||||
TokenType.str_start : "^\\bstart\\b",
|
||||
TokenType.str_end : "^\\bend\\b",
|
||||
@ -151,6 +153,12 @@ func tokenize():
|
||||
if result == null || result.get_start() != 0 :
|
||||
continue
|
||||
|
||||
# Skip Comments
|
||||
if type == TokenType.cmt_SL :
|
||||
Cursor += result.get_string().length()
|
||||
error = false
|
||||
break
|
||||
|
||||
# Skip Whitespace
|
||||
if type == TokenType.fmt_S :
|
||||
var addVal = result.get_string().length()
|
||||
|
Loading…
x
Reference in New Issue
Block a user