user164226
user164226

Reputation:

What is the term for the '@' in Razor syntax?

The material I've read generally uses phrases like 'use the @ character here to denote the start...' but I want to know what to call such a character. A coworker suggested the word 'token' but I don't think that's correct.

Upvotes: 3

Views: 116

Answers (1)

haim770
haim770

Reputation: 49095

Brifely looking at the source code, the Razor team seem to refer to it as Transition Symbol.

In SyntaxConstants:

namespace System.Web.Razor.Parser
{
    public static class SyntaxConstants
    {
        public static readonly char TransitionCharacter = '@';
        public static readonly string TransitionString = "@";
    }
}

Also in HtmlSymbolType.Transition:

namespace System.Web.Razor.Tokenizer.Symbols
{
    public enum HtmlSymbolType
    {
        ...
        Transition, // @
    }
} 

Still, I doubt you can formally name it "Transition", it's seems more like an internal term of the parser to denote contexts switches (for example from HTML to C# and vice versa).

Upvotes: 5

Related Questions