Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hex color codes error #15

Closed
pfgithub opened this issue Mar 31, 2023 · 4 comments
Closed

hex color codes error #15

pfgithub opened this issue Mar 31, 2023 · 4 comments
Assignees

Comments

@pfgithub
Copy link

Using hex color codes causes "invalid statement provided"

.comment : style {
   color                 = #aaffaa
   color                 = "#aaffaa"; // doesn't work either
   textmate_scope        = comment
}
Example file with error
#################################################################
## Iro
################################################################ 
##
## * Press Ctrl + '+'/'-' To Zoom in
## * Press Ctrl + S to save and recalculate... 
## * Documents are saved to web storage.
## * Only one save slot supported.
## * Matches cannot span lines.
## * Unicode chars must be defined in \u0000 to \uffff format.
## * All matches must be contained by a single group ( ... )
## * Look behinds not permitted, (?<= or (?<!
## * Look forwards are permitted (?= or (?!
## * Constants are defined as __my_const = (......)
## * The \= format allows unescaped regular expressions
## * Constants referenced by match \= $${__my_const}
## * Constants can reference other constants
## * You are free to delete all the default scopes.
## * Twitter : ainslec , Web: http://eeyo.io/iro
##
################################################################

name                   = mysample
file_extensions []     = mysample;

################################################################
## Constants
################################################################

__MY_CONSTANT \= (\b[a-z][a-z0-9]*)

################################################################
## Styles
################################################################

styles [] {

.comment : style {
   color                 = #aaffaa
   italic                = true
   ace_scope             = comment
   textmate_scope        = comment
   pygments_scope        = Comment
}

.keyword : style {
   color     = cyan
   ace_scope             = keyword
   textmate_scope        = keyword
   pygments_scope        = Keyword
}

.numeric : style {
   color                 = gold
   ace_scope             = constant.numeric
   textmate_scope        = constant.numeric
   pygments_scope        = Number
}

.punctuation : style {
   color     = red_2
   ace_scope             = punctuation
   textmate_scope        = punctuation
   pygments_scope        = Punctuation
}

.text : style {
   color                 = brown
   ace_scope             = text
   textmate_scope        = text
   pygments_scope        = String
}

.illegal : style {
   color                 = white
   background_color      = red
   ace_scope             = invalid
   textmate_scope        = invalid
   pygments_scope        = Generic.Error
}

}

#################################################
## Parse contexts
#################################################

contexts [] {

##############################################
## Main Context - Entry point context
##############################################

main : context {

   : pattern {
      regex          \= $${__MY_CONSTANT}
      styles []       = .keyword;
   }
   
   : include "numeric" ;
   
   : inline_push {
      regex          \= (\{)
      styles []       = .punctuation;
      : pop {  
         regex       \= (\})
         styles []    = .punctuation;
      }
      : include "main" ;
   }
   
   : pattern {
      regex          \= (;)
      styles []       = .punctuation;
   }
   
   : inline_push {
      regex          \= (\")
      styles []       = .punctuation;
      default_style   = .text
      : pop {
         regex       \= (\")
         styles []    = .punctuation;
      }
   }
   
   : inline_push {
      regex          \= (\()
      styles []       = .punctuation;
      : pop {
         regex       \= (\))
         styles []    = .punctuation;
      }
      : include "numeric" ;
      : pattern {
         regex       \= (,)
         styles []    = .punctuation;
      }
   }
   
   : include "multi_line_comment" ;
   
   : pattern {
      regex          \= (//.*)
      styles []       = .comment;
   }
   
   : pattern {
      regex          \= ([^\s])
      styles []       = .illegal;
   }
   
}

#################################################
## End of Contexts
#################################################

###########################################
## Numeric Context
###########################################

numeric : context {
   : pattern {
      regex          \= (\b\d+)
      styles []       = .numeric;
   }
}

###########################################
## Multi Line Comment Context
###########################################

multi_line_comment : context {
   description        = multiline
   : inline_push {
      regex          \= (/\*)
      styles []       = .comment;
      default_style   = .comment
      : pop {
         regex       \= (\*/)
         styles []    = .comment;
      }
   }
}
   
}

Error:

line 40:25 extraneous input '=' expecting {'[]', '}', ':', IDENTIFIER}
[ERROR] Line 40 - Invalid statement provided, unrecognized.
@svallory
Copy link

svallory commented Apr 4, 2023

@pfgithub try without the #

@pfgithub
Copy link
Author

pfgithub commented Apr 4, 2023

Iro doesn't allow this:

Color must be privded as a color alias (such as white, red, black, blue, green), or a hexidecimal REG color in the format #000 - #fff or #000000 - #ffffff

@svallory
Copy link

svallory commented Apr 5, 2023

You are correct, @pfgithub. But I removed the # and it worked. It is a bug.

@c272 c272 self-assigned this May 18, 2023
@c272
Copy link
Owner

c272 commented May 18, 2023

Sorry for the late response to this issue, it seemed to slip past my notifications. I've just added support for this in the latest master, it'll be in a release with a few other fixes fairly soon.

@c272 c272 closed this as completed May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants