Пример #1
0
 private void PushDedents(int untilPosition)
 {
     while (Indents.Peek() > untilPosition)
     {
         Indents.Pop();
         PushOutlineToken(_grammar.Dedent, CurrentToken.Location);
     }
 }
Пример #2
0
 public override void Reset()
 {
     Indents.Clear();
     Indents.Push(0);
     OutputTokens.Clear();
     PreviousToken         = null;
     CurrentToken          = null;
     PreviousTokenLocation = new SourceLocation();
 }
Пример #3
0
 protected string Indent(string test)
 {
     test = test ?? string.Empty;
     if (!Indents.ContainsKey(test))
     {
         return(test);
     }
     else
     {
         return(test.Indent(2 * Indents[test]));
     }
 }
Пример #4
0
        private string ExtractIndent(string test, bool setIndent)
        {
            test = test ?? string.Empty;
            string trimmedTest = test.TrimStart(' ');
            int    indent      = (test.Length - trimmedTest.Length) / 2;
            int    oldIndent   = 0;

            if (Indents.ContainsKey(trimmedTest))
            {
                oldIndent = Indents[trimmedTest];
            }
            if (setIndent && oldIndent < indent)
            {
                Indents[trimmedTest] = indent;
            }
            return(trimmedTest);
        }
Пример #5
0
        public IToken <INode> PeekToken()
        {
            if (Store.IsNull())
            {
READ_LINE_:
                var line = BaseReader.LineNumber;
                var ts = ReadLineTokens(BaseReader, Parser?.TokenStack.LastOrNull());
                if (ts.First().Type == Symbols.EOL)
                {
                    goto READ_LINE_;
                }
                Store.AddRange(ts);

                if (!Store[0].EndOfToken && (Indents.Count == 0 || Store[0].Indent > Indents.Peek()))
                {
                    Store.Insert(0, new Token {
                        Type = Symbols.BEGIN, LineNumber = line, Indent = Store[0].Indent
                    });
                    Indents.Push(Store[0].Indent);
                }
                else
                {
                    var count = 0;
                    var head  = Store[0];
                    while (Indents.Count > 0 && (head.EndOfToken || head.Indent < Indents.Peek()))
                    {
                        Store.Insert(count, new Token {
                            Type = Symbols.END, LineNumber = line, Indent = Indents.Pop()
                        });
                        count++;
                    }
                }
            }

READ_FIRST_:
            var first = Store.First();

            if (Parser is { } && first.Type == Symbols.EOL && !Parser.IsAccept(first))
Пример #6
0
        public int SaveIndent(Indent indent)
        {
            try
            {
                // add into technologies if not found
                int compid = (from t in this.Departments
                              where t.DepartmentID == indent.DepartmentID
                              select t.CompanyID).FirstOrDefault();
                if (indent.Technologies != null)
                {
                    string[] techs = indent.Technologies.Split(';');
                    if (techs.Length > 0)
                    {
                        foreach (string tech in techs)
                        {
                            if (!string.IsNullOrWhiteSpace(tech))
                            {
                                string t   = tech.Trim();
                                var    cnt = this.TechnologiesAndSkills.Count(a => a.Code.Trim().Equals(t));
                                if (cnt == 0)
                                {
                                    TechnologiesAndSkills a = new Entity.TechnologiesAndSkills()
                                    {
                                        Code      = t,
                                        Name      = t,
                                        Active    = true,
                                        CompanyID = compid,
                                        SkillType = 1
                                    };
                                    TechnologiesAndSkills.Add(a);
                                }
                            }
                        }
                    }
                }
                // add/update indent
                var count = this.Indents.Count(a => a.IndentID.Equals(indent.IndentID));
                if (count == 0)
                {
                    var code = (from t in this.Departments
                                join c in this.Company on t.CompanyID equals c.CompanyID
                                where t.DepartmentID == indent.DepartmentID
                                select new { CompanyCode = c.Code, DepartmentCode = t.Code }).FirstOrDefault();

                    //Tuple<string, string> d = code.Select(x => new Tuple<string, string>(x.CompanyCode, x.DepartmentCode)).FirstOrDefault();
                    //int max = from t in this.Indents
                    int maxValue = 1;
                    try
                    {
                        var i = this.Indents.Count(x => x.DepartmentID.Equals(indent.DepartmentID) && x.CreatedDate.Value.Year.Equals(DateTime.Now.Year));
                        maxValue += i;
                    }
                    catch { }
                    indent.IndentNumber = code.CompanyCode + "-" + code.DepartmentCode + "-" + DateTime.UtcNow.Year + "-" + maxValue.ToString().PadLeft(4, '0');
                    var dr = (from t in this.DepartmentRoles
                              join u in this.Users on t.FunctionHead equals u.UserID
                              join u1 in this.Users on t.SVP equals u1.UserID
                              where t.DepartmentID == indent.DepartmentID && t.BranchID == indent.BranchID
                              select new { FunctionHead = u.Name, SVP = u1.Name }).FirstOrDefault();

                    indent.CreatedDate         = DateTime.UtcNow;
                    indent.FunctionHead        = dr.FunctionHead;
                    indent.SeniorVicePresident = dr.SVP;
                    Indents.Add(indent);
                }
                else
                {
                    Indent u = this.Indents.Where(s => s.IndentID == indent.IndentID).FirstOrDefault <Indent>();
                    // change contact in disconnected mode (out of DBContext scope)
                    if (u != null)
                    {
                        //u.IndentDate = indent.IndentDate.HasValue ? indent.IndentDate.Value : (DateTime?) null;
                        u.Indentor          = indent.Indentor;
                        u.IndentorRemarks   = indent.IndentorRemarks;
                        u.BranchID          = indent.BranchID;
                        u.DepartmentID      = indent.DepartmentID;
                        u.Client_Domain     = indent.Client_Domain;
                        u.ProjectStatusID   = indent.ProjectStatusID;
                        u.ReasonID          = indent.ReasonID;
                        u.LocationTypeID    = indent.LocationTypeID;
                        u.EmploymentTypeID  = indent.EmploymentTypeID;
                        u.ContractMonths    = indent.ContractMonths;
                        u.StaffingModeID    = indent.StaffingModeID;
                        u.Technologies      = indent.Technologies;
                        u.TechnicalSkills   = indent.TechnicalSkills;
                        u.BehaviouralSkills = indent.BehaviouralSkills;
                        u.PositionTitle     = indent.PositionTitle;
                        u.NoOfPositions     = indent.NoOfPositions;
                        u.MinExperiance     = indent.MinExperiance;
                        u.MaxExperiance     = indent.MaxExperiance;
                        u.VisaType          = indent.VisaType;
                        u.TargetJoinDate    = indent.TargetJoinDate.HasValue ? indent.TargetJoinDate.Value : (DateTime?)null;
                        u.InterviewPanel1   = indent.InterviewPanel1;
                        u.InterviewPanel2   = indent.InterviewPanel2;
                        u.ReportingManager  = indent.ReportingManager;
                        u.Qualification     = indent.Qualification;
                        u.Others            = indent.Others;
                        u.FunctionHead      = indent.FunctionHead;
                        //u.FunctionHeadStatusDate = indent.FunctionHeadStatusDate.HasValue ? indent.FunctionHeadStatusDate.Value : (DateTime?)null; ;
                        u.FunctionHeadRemarks = indent.FunctionHeadRemarks;
                        u.SeniorVicePresident = indent.SeniorVicePresident;
                        //u.SeniorVicePresidentStatusDate = indent.SeniorVicePresidentStatusDate.HasValue ? indent.SeniorVicePresidentStatusDate.Value : (DateTime?)null; ;
                        u.SeniorVicePresidentRemarks = indent.SeniorVicePresidentRemarks;
                        u.JobDescription             = indent.JobDescription;
                        u.UploadFile_Indents         = indent.UploadFile_Indents;
                        u.DeploymentLocation         = indent.DeploymentLocation;
                        u.Indent_Status   = indent.Indent_Status;
                        u.StatusChangedBy = indent.StatusChangedBy;
                        u.ModifiedBy      = indent.ModifiedBy;
                        u.ModifiedDate    = DateTime.UtcNow;
                    }
                    this.Entry(u).State = EntityState.Modified;
                }

                this.SaveChanges();

                return(indent.IndentID);
            }
            catch
            {
                throw;
            }
        }
Пример #7
0
        public void ProcessToken(Token token)
        {
            SetCurrentToken(token);
            //Quick checks
            if (_isContinuation)
            {
                return;
            }

            var tokenTerm = token.Terminal;

            //check EOF
            if (tokenTerm == _grammar.Eof)
            {
                ProcessEofToken();
                return;
            }

            if (tokenTerm != _grammar.LineStartTerminal)
            {
                return;
            }
            //if we are here, we have LineStart token on new line; first remove it from stream, it should not go to parser
            OutputTokens.Pop();

            if (PreviousToken == null)
            {
                return;
            }


            // first check if there was continuation symbol before
            // or - if checkBraces flag is set - check if there were open braces
            if (_prevIsContinuation || _checkBraces && _context.OpenBraces.Count > 0)
            {
                return; //no Eos token in this case
            }

            if (_prevIsOperator && _checkOperator)
            {
                return; //no Eos token in this case
            }

            //We need to produce Eos token and indents (if _produceIndents is set).
            // First check indents - they go first into OutputTokens stack, so they will be popped out last
            if (_produceIndents)
            {
                var currIndent = token.Location.Column;
                var prevIndent = Indents.Peek();
                if (currIndent > prevIndent)
                {
                    Indents.Push(currIndent);
                    PushOutlineToken(_grammar.Indent, token.Location);
                }
                else if (currIndent < prevIndent)
                {
                    PushDedents(currIndent);
                    //check that current indent exactly matches the previous indent
                    if (Indents.Peek() != currIndent)
                    {
                        //fire error
                        OutputTokens.Push(new Token(_grammar.SyntaxError, token.Location, string.Empty, Resources.ErrInvDedent));
                        // "Invalid dedent level, no previous matching indent found."
                    }
                }
            }

            //Finally produce Eos token, but not in command line mode. In command line mode the Eos was already produced
            // when we encountered Eof on previous line
            if (_context.Mode != ParseMode.CommandLine)
            {
                var eosLocation = ComputeEosLocation();
                PushOutlineToken(_grammar.Eos, eosLocation);
            }
        }
Пример #8
0
        public override void InitElements()
        {
            base.InitElements();
            Color   gray   = Color.FromArgb(150, 150, 150);
            Indents margin = new Indents();
            int     width  = 120;

            _win.SetWidth(width);
            _win.SetMargin(margin);
            _win.SetBackground(gray);

            _lMouse.SetWidth(width);
            _lMouse.SetMargin(margin);
            _lMouse.SetBackground(gray);

            _rMouse.SetWidth(width);
            _rMouse.SetMargin(margin);
            _rMouse.SetBackground(gray);

            _mMouse.SetWidth(width);
            _mMouse.SetMargin(margin);
            _mMouse.SetBackground(gray);

            _apply.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Right);
            _apply.SetMargin(0, 0, 20, 20);

            _deleteLast.IsFocusable = false;
            _win.IsFocusable        = false;
            _lMouse.IsFocusable     = false;
            _rMouse.IsFocusable     = false;
            _mMouse.IsFocusable     = false;

            HorizontalStack textFieldlayout = Factory.Items.GetFixedHorizontalStack(30);

            textFieldlayout.SetMargin(100, 100, 100, 0);

            HorizontalStack toolbarlayout = Factory.Items.GetFixedHorizontalStack(30);

            toolbarlayout.SetMargin(40, 0, 40, 100);
            toolbarlayout.SetAlignment(ItemAlignment.Bottom, ItemAlignment.Left);
            toolbarlayout.SetSpacing(6, 0);

            Frame header = new Frame();

            header.SetHeightPolicy(SizePolicy.Fixed);
            header.SetHeight(40);
            header.SetBackground(Factory.Palette.ExclusiveDark);

            Window.SetMinSize(600, 300);
            Window.AddItems(header, _close, textFieldlayout, toolbarlayout, _apply);

            textFieldlayout.AddItems(_bind, _deleteLast);

            toolbarlayout.AddItems(_win, _lMouse, _rMouse, _mMouse);

            _deleteLast.EventMouseClick += (sender, args) =>
            {
                if (_keySequence.Count > 0)
                {
                    _keySequence.RemoveAt(_keySequence.Count - 1);
                    SetShortcutSequence();
                }
            };

            _win.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.LeftSuper);
            };
            _lMouse.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.MouseLeft);
            };
            _rMouse.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.MouseRight);
            };
            _mMouse.EventMouseClick += (sender, args) =>
            {
                OnKeyDown(HardwareButtons.MouseMiddle);
            };

            _bind.SetEditable(false);
            _bind.EventKeyPress += (sender, args) =>
            {
                OnKeyDown((HardwareButtons)args.Key);
            };

            _close.EventMouseClick += (sender, args) =>
            {
                Close();
            };

            _apply.EventMouseClick += (sender, args) =>
            {
                Result = _bind.GetText();
                Close();
            };
        }
        public string Format(string javascript)
        {
            this._builder       = new StringBuilder(javascript.Length);
            this._indents       = new Indents();
            this._parenCount    = 0;
            this._bracketCount  = 0;
            this._lineFlags     = JSLineFlags.None;
            this._nextLineFlags = JSLineFlags.None;
            JSTokenizer jSTokenizer = new JSTokenizer(javascript);
            bool        flag        = false;
            bool        flag2       = true;

            while (jSTokenizer.GetToken())
            {
                JSToken token = jSTokenizer.Token;
                if (this._builder.Length > 0)
                {
                    flag2 = flag;
                    if (flag)
                    {
                        this.NewLine();
                        flag = false;
                    }
                }
                switch (token.Type)
                {
                case JSTokenTypes.OpenBrace:
                {
                    if (!flag2)
                    {
                        if (this.OpenBraceOnNewLine && this._builder.Length > 0)
                        {
                            this.NewLine();
                        }
                        else if (token.PreviousType != JSTokenTypes.CRLF && token.PreviousType != JSTokenTypes.OpenParen && token.PreviousType != JSTokenTypes.OpenBracket)
                        {
                            this._builder.Append(' ');
                        }
                    }
                    this._builder.Append(token.Value);
                    JSToken jSToken = jSTokenizer.PeekToken();
                    if (jSToken.Type != JSTokenTypes.CloseBrace)
                    {
                        JSIndentFlags jSIndentFlags = JSIndentFlags.None;
                        if (JSFormatter.HasFlags((int)this._lineFlags, 2))
                        {
                            jSIndentFlags |= JSIndentFlags.DoBlock;
                        }
                        else if (JSFormatter.HasFlags((int)this._lineFlags, 8))
                        {
                            jSIndentFlags |= JSIndentFlags.CaseBlock;
                        }
                        this._indents.Indent(jSIndentFlags);
                        flag = true;
                        continue;
                    }
                    jSTokenizer.GetToken();
                    this._builder.Append(jSTokenizer.Token.Value);
                    jSToken = jSTokenizer.PeekToken();
                    if (jSToken.Type != JSTokenTypes.SemiColon && jSToken.Type != JSTokenTypes.Comma)
                    {
                        while (JSFormatter.HasFlags((int)this._indents.Current, 1))
                        {
                            this._indents.Unindent();
                        }
                        flag = true;
                        continue;
                    }
                    if (jSToken.Type == JSTokenTypes.Comma)
                    {
                        jSTokenizer.GetToken();
                        this._builder.Append(jSTokenizer.Token.Value);
                        continue;
                    }
                    continue;
                }

                case JSTokenTypes.CloseBrace:
                {
                    if (JSFormatter.HasFlags((int)this._indents.Current, 4))
                    {
                        this._indents.Unindent();
                        if (flag2)
                        {
                            Indents.StripTrailingIndent(this._builder);
                        }
                    }
                    while (JSFormatter.HasFlags((int)this._indents.Current, 1))
                    {
                        this._indents.Unindent();
                    }
                    this._indents.Unindent();
                    if (flag2)
                    {
                        Indents.StripTrailingIndent(this._builder);
                    }
                    else
                    {
                        this.NewLine();
                    }
                    this._builder.Append(token.Value);
                    JSToken jSToken = jSTokenizer.PeekToken();
                    if (jSToken.Value != "catch" && jSToken.Value != "finally" && jSToken.Value != ":")
                    {
                        while (JSFormatter.HasFlags((int)this._indents.Current, 1))
                        {
                            this._indents.Unindent();
                        }
                    }
                    if (JSFormatter.HasFlags((int)this._indents.LastIndent, 2))
                    {
                        this._lineFlags |= JSLineFlags.EndDoBlock;
                    }
                    if (jSToken.Type != JSTokenTypes.CRLF && jSToken.Type != JSTokenTypes.SemiColon && jSToken.Type != JSTokenTypes.CloseParen && jSToken.Type != JSTokenTypes.CloseBracket && jSToken.Type != JSTokenTypes.Comma && jSToken.Type != JSTokenTypes.OpenParen && jSToken.Type != JSTokenTypes.Colon && !JSFormatter.HasFlags((int)this._lineFlags, 4))
                    {
                        flag = true;
                        continue;
                    }
                    continue;
                }

                case JSTokenTypes.OpenParen:
                    if (!flag2 && token.PreviousType != JSTokenTypes.CRLF && token.PreviousType != JSTokenTypes.OpenParen && token.PreviousType != JSTokenTypes.UnaryPrefix && token.PreviousType != JSTokenTypes.CloseBracket && token.PreviousType != JSTokenTypes.CloseParen && token.PreviousType != JSTokenTypes.CloseBrace && (token.PreviousType != JSTokenTypes.Symbol || (JSFormatter.HasFlags((int)this._lineFlags, 1) && this._parenCount == 0)))
                    {
                        this._builder.Append(' ');
                    }
                    this._builder.Append(token.Value);
                    this._parenCount++;
                    continue;

                case JSTokenTypes.CloseParen:
                {
                    this._builder.Append(token.Value);
                    this._parenCount--;
                    if (this._parenCount < 0)
                    {
                        this._parenCount = 0;
                    }
                    if (this._parenCount != 0 || !JSFormatter.HasFlags((int)this._lineFlags, 1))
                    {
                        continue;
                    }
                    JSToken jSToken = jSTokenizer.PeekToken();
                    if (jSToken.Type != JSTokenTypes.OpenBrace)
                    {
                        this._indents.Indent(JSIndentFlags.NoBraces);
                        flag = true;
                        continue;
                    }
                    continue;
                }

                case JSTokenTypes.OpenBracket:
                {
                    if (!flag2 && token.PreviousType != JSTokenTypes.CRLF && token.PreviousType != JSTokenTypes.Symbol && token.PreviousType != JSTokenTypes.OpenParen && token.PreviousType != JSTokenTypes.CloseParen && token.PreviousType != JSTokenTypes.CloseBracket)
                    {
                        this._builder.Append(' ');
                    }
                    JSToken jSToken = jSTokenizer.PeekToken();
                    if (JSFormatter.HasFlags((int)this._lineFlags, 16) && jSToken.Type != JSTokenTypes.CloseBracket && jSToken.Type == JSTokenTypes.OpenBrace && this._parenCount == 0)
                    {
                        if (this.OpenBraceOnNewLine)
                        {
                            this.NewLine();
                        }
                        this._indents.Indent(JSIndentFlags.BracketBlock);
                        flag = true;
                    }
                    this._builder.Append(token.Value);
                    this._bracketCount++;
                    continue;
                }

                case JSTokenTypes.CloseBracket:
                    this._bracketCount = Math.Max(this._bracketCount - 1, 0);
                    if (!JSFormatter.HasFlags((int)this._indents.Current, 8))
                    {
                        this._builder.Append(token.Value);
                        continue;
                    }
                    this._indents.Unindent();
                    if (flag2)
                    {
                        Indents.StripTrailingIndent(this._builder);
                        this._builder.Append(token.Value);
                        continue;
                    }
                    this.NewLine();
                    this._builder.Append(token.Value);
                    continue;

                case JSTokenTypes.Symbol:
                {
                    bool flag3 = Array.IndexOf <string>(JSFormatter._blockKeywords, token.Value) > -1;
                    if (token.Value == "else" && jSTokenizer.PeekToken().Value != "if")
                    {
                        flag3 = true;
                    }
                    if (JSFormatter.HasFlags((int)this._indents.Current, 4) && (token.Value == "case" || token.Value == "default"))
                    {
                        Indents.StripTrailingIndent(this._builder);
                        this._indents.Unindent();
                    }
                    if (this._parenCount != 0 || !flag3)
                    {
                        if (!flag2 && token.PreviousType != JSTokenTypes.CRLF && token.PreviousType != JSTokenTypes.OpenParen && token.PreviousType != JSTokenTypes.OpenBracket && token.PreviousType != JSTokenTypes.UnaryPrefix && token.PreviousType != JSTokenTypes.Dot)
                        {
                            this._builder.Append(' ');
                        }
                        if (token.Value == "case" || token.Value == "default")
                        {
                            this._lineFlags |= JSLineFlags.CaseKeyword;
                        }
                        this._builder.Append(token.Value);
                        continue;
                    }
                    if (!flag2)
                    {
                        this._builder.Append(' ');
                    }
                    this._builder.Append(token.Value);
                    if (JSFormatter.HasFlags((int)this._lineFlags, 4) && !(token.Value != "while"))
                    {
                        continue;
                    }
                    if (token.Value == "do")
                    {
                        this._lineFlags |= JSLineFlags.DoKeyword;
                    }
                    JSToken jSToken = jSTokenizer.PeekToken();
                    if (jSToken.Type == JSTokenTypes.OpenBrace || jSToken.Type == JSTokenTypes.OpenParen)
                    {
                        this._lineFlags |= JSLineFlags.BlockKeyword;
                        continue;
                    }
                    JSIndentFlags jSIndentFlags2 = JSIndentFlags.NoBraces;
                    if (JSFormatter.HasFlags((int)this._lineFlags, 2))
                    {
                        jSIndentFlags2 |= JSIndentFlags.DoBlock;
                    }
                    this._indents.Indent(jSIndentFlags2);
                    flag = true;
                    continue;
                }

                case JSTokenTypes.String:
                case JSTokenTypes.Number:
                case JSTokenTypes.RegEx:
                    if (!flag2 && token.PreviousType != JSTokenTypes.CRLF && token.PreviousType != JSTokenTypes.OpenParen && token.PreviousType != JSTokenTypes.OpenBracket && token.PreviousType != JSTokenTypes.UnaryPrefix)
                    {
                        this._builder.Append(' ');
                    }
                    this._builder.Append(token.Value);
                    continue;

                case JSTokenTypes.SemiColon:
                    this._builder.Append(token.Value);
                    if (this._parenCount == 0)
                    {
                        while (JSFormatter.HasFlags((int)this._indents.Current, 1))
                        {
                            this._indents.Unindent();
                        }
                        if (JSFormatter.HasFlags((int)this._indents.LastIndent, 2))
                        {
                            this._nextLineFlags |= JSLineFlags.EndDoBlock;
                        }
                        JSToken jSToken = jSTokenizer.PeekToken();
                        if (jSToken.Type == JSTokenTypes.FullLineComment || jSToken.Type == JSTokenTypes.InlineComment)
                        {
                            bool flag4;
                            if (jSToken.Type == JSTokenTypes.FullLineComment)
                            {
                                flag4 = this.NewLineBeforeLineComment;
                            }
                            else
                            {
                                flag4 = this.NewLineBeforeInlineComment;
                            }
                            jSTokenizer.GetToken();
                            if (flag4)
                            {
                                this.NewLine();
                            }
                            else
                            {
                                this._builder.Append(' ');
                            }
                            this._builder.Append(jSTokenizer.Token.Value);
                        }
                        flag = true;
                        continue;
                    }
                    continue;

                case JSTokenTypes.Comma:
                    this._builder.Append(token.Value);
                    if (token.PreviousType == JSTokenTypes.CloseBrace || (JSFormatter.HasFlags((int)this._lineFlags, 16) && this._parenCount == 0 && this._bracketCount == 0 && this._indents.Count > 0))
                    {
                        flag = true;
                        continue;
                    }
                    continue;

                case JSTokenTypes.Colon:
                    if (JSFormatter.HasFlags((int)this._lineFlags, 8))
                    {
                        this._builder.Append(token.Value);
                        this._indents.Indent(JSIndentFlags.CaseBlock);
                        flag = true;
                        continue;
                    }
                    if (!flag2 && (JSFormatter.HasFlags((int)this._lineFlags, 32) || token.PreviousType == JSTokenTypes.CloseBrace))
                    {
                        this._builder.Append(' ');
                    }
                    this._builder.Append(token.Value);
                    if (!JSFormatter.HasFlags((int)this._lineFlags, 32))
                    {
                        this._lineFlags |= JSLineFlags.JsonColon;
                        continue;
                    }
                    continue;

                case JSTokenTypes.QuestionMark:
                    this._lineFlags |= JSLineFlags.QuestionMark;
                    if (!flag2)
                    {
                        this._builder.Append(' ');
                    }
                    this._builder.Append(token.Value);
                    continue;

                case JSTokenTypes.BinaryOperator:
                case JSTokenTypes.UnaryPrefix:
                    if (!flag2 && token.PreviousType != JSTokenTypes.OpenParen && token.PreviousType != JSTokenTypes.OpenBracket && token.PreviousType != JSTokenTypes.UnaryPrefix)
                    {
                        this._builder.Append(' ');
                    }
                    this._builder.Append(token.Value);
                    continue;

                case JSTokenTypes.FullLineComment:
                    if (!flag2)
                    {
                        if (this.NewLineBeforeLineComment)
                        {
                            this.NewLine();
                        }
                        else
                        {
                            this._builder.Append(' ');
                        }
                    }
                    this._builder.Append(token.Value);
                    flag = true;
                    continue;

                case JSTokenTypes.InlineComment:
                    if (!flag2)
                    {
                        if (this.NewLineBeforeInlineComment)
                        {
                            this.NewLine();
                        }
                        else
                        {
                            this._builder.Append(' ');
                        }
                    }
                    this._builder.Append(token.Value);
                    if (this.NewLineAfterInlineComment)
                    {
                        flag = true;
                        continue;
                    }
                    continue;

                case JSTokenTypes.CRLF:
                    if (!flag2)
                    {
                        flag = true;
                        continue;
                    }
                    continue;
                }
                this._builder.Append(token.Value);
            }
            this._builder.AppendLine();
            return(this._builder.ToString());
        }