Attributes.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. namespace NTERA.Interpreter
  3. {
  4. [AttributeUsage(AttributeTargets.Field)]
  5. public class LexerCharacterAttribute : Attribute
  6. {
  7. public char Character { get; }
  8. public LexerCharacterAttribute(char character)
  9. {
  10. Character = character;
  11. }
  12. }
  13. [AttributeUsage(AttributeTargets.Field)]
  14. public class LexerKeywordAttribute : Attribute
  15. {
  16. public string Keyword { get; }
  17. public bool IsLineKeyword { get; }
  18. public LexerKeywordAttribute(string keyword, bool isLineKeyword = false)
  19. {
  20. Keyword = keyword;
  21. IsLineKeyword = isLineKeyword;
  22. }
  23. }
  24. [AttributeUsage(AttributeTargets.Method)]
  25. public class KeywordMethodAttribute : Attribute
  26. {
  27. public Token Token { get; }
  28. public KeywordMethodAttribute(Token token)
  29. {
  30. Token = token;
  31. }
  32. }
  33. [AttributeUsage(AttributeTargets.Method)]
  34. public class BuiltInFunctionAttribute : Attribute
  35. {
  36. public string Name { get; }
  37. public BuiltInFunctionAttribute(string name)
  38. {
  39. Name = name;
  40. }
  41. }
  42. }