Corrections to Lecture 12, fixing some regex

This commit is contained in:
Edward R. Gonzalez 2022-07-12 01:38:54 -04:00
parent 7544c4bedc
commit 948974857a
4 changed files with 53 additions and 53 deletions

View File

@ -50,8 +50,8 @@ const TokenType = \
const TokenSpec = \ const TokenSpec = \
{ {
# Comments # Comments
TokenType.CommentLine : "^\/\/.*", TokenType.CommentLine : "^\\/\\/.*",
TokenType.CommentMultiLine : "^\/\\*[\\s\\S]*?\\*\/", TokenType.CommentMultiLine : "^\\/\\*[\\s\\S]*?\\*\\/",
# Formatting # Formatting
TokenType.Whitespace : "^\\s+", TokenType.Whitespace : "^\\s+",

View File

@ -56,8 +56,8 @@ const TokenType = \
const TokenSpec = \ const TokenSpec = \
{ {
# Comments # Comments
TokenType.CommentLine : "^\/\/.*", TokenType.CommentLine : "^\\/\\/.*",
TokenType.CommentMultiLine : "^\/\\*[\\s\\S]*?\\*\/", TokenType.CommentMultiLine : "^\\/\\*[\\s\\S]*?\\*\\/",
# Formatting # Formatting
TokenType.Whitespace : "^\\s+", TokenType.Whitespace : "^\\s+",

View File

@ -57,8 +57,8 @@ const TokenType = \
const TokenSpec = \ const TokenSpec = \
{ {
# Comments # Comments
TokenType.CommentLine : "^\/\/.*", TokenType.CommentLine : "^\\/\\/.*",
TokenType.CommentMultiLine : "^\/\\*[\\s\\S]*?\\*\/", TokenType.CommentMultiLine : "^\\/\\*[\\s\\S]*?\\*\\/",
# Formatting # Formatting
TokenType.Whitespace : "^\\s+", TokenType.Whitespace : "^\\s+",
@ -68,11 +68,11 @@ const TokenSpec = \
TokenType.ExpressionPEnd : "^\\)", TokenType.ExpressionPEnd : "^\\)",
# Logical # Logical
TokenType.Logical_Not : "^!",
TokenType.RelationalOp : "^[>\\<]=?", TokenType.RelationalOp : "^[>\\<]=?",
TokenType.EqualityOp : "^[=!]=", TokenType.EqualityOp : "^[=!]=",
TokenType.Logical_And : "^&&", TokenType.Logical_And : "^&&",
TokenType.Logical_Or : "^\\|\\|", TokenType.Logical_Or : "^\\|\\|",
TokenType.Logical_Not : "^!",
# Arithmetic # Arithmetic
TokenType.ComplexAssignment : "^[*\\/\\+\\-]=", TokenType.ComplexAssignment : "^[*\\/\\+\\-]=",
@ -830,51 +830,51 @@ func tout(text):
const Tests = \ const Tests = \
{ {
# MultiStatement = \ MultiStatement = \
# { {
# Name = "Multi-Statement", Name = "Multi-Statement",
# File = "1.Multi-Statement.uf" File = "1.Multi-Statement.uf"
# }, },
# BlockStatement = \ BlockStatement = \
# { {
# Name = "Block Statement", Name = "Block Statement",
# File = "2.BlockStatement.uf" File = "2.BlockStatement.uf"
# }, },
# BinaryExpression = \ BinaryExpression = \
# { {
# Name = "Binary Expression", Name = "Binary Expression",
# File = "3.BinaryExpression.uf" File = "3.BinaryExpression.uf"
# }, },
# Assignment = \ Assignment = \
# { {
# Name = "Assignment", Name = "Assignment",
# File = "4.Assignment.uf" File = "4.Assignment.uf"
# }, },
# VaraibleDeclaration = \ VaraibleDeclaration = \
# { {
# Name = "Variable Declaration", Name = "Variable Declaration",
# File = "5.VariableDeclaration.uf" File = "5.VariableDeclaration.uf"
# }, },
# Conditionals = \ Conditionals = \
# { {
# Name = "Conditionals", Name = "Conditionals",
# File = "6.Conditionals.uf" File = "6.Conditionals.uf"
# }, },
# Relations = \ Relations = \
# { {
# Name = "Relations", Name = "Relations",
# File = "7.Relations.uf" File = "7.Relations.uf"
# }, },
# Equality = \ Equality = \
# { {
# Name = "Equality", Name = "Equality",
# File = "8.Equality.uf" File = "8.Equality.uf"
# }, },
# Logical = \ Logical = \
# { {
# Name = "Logical", Name = "Logical",
# File = "9.Logical.uf" File = "9.Logical.uf"
# }, },
Unary = \ Unary = \
{ {
Name = "Unary", Name = "Unary",

View File

@ -45,7 +45,7 @@ const TokenSpec = \
{ {
# Comments # Comments
TokenType.CommentLine : "^\/\/.*", TokenType.CommentLine : "^\/\/.*",
TokenType.CommentMultiLine : "^\/\\*[\\s\\S]*?\\*\/", TokenType.CommentMultiLine : "^\/\\*[\\s\\S]*?\\*\\/",
# Formatting # Formatting
TokenType.Whitespace : "^\\s+", TokenType.Whitespace : "^\\s+",