Package org.objectstyle.wolips.wodclipse.core.parser

Examples of org.objectstyle.wolips.wodclipse.core.parser.WodScanner


  // MS: all these savedRulePositions should be switched to instead use the rulePositions stack ...
  protected synchronized void parse() {
    clear();

    WodScanner scanner = WodScanner.wodScannerForDocument(_document);
    DocumentWodBinding lastBinding = null;
    DocumentWodElement element = null;
    RulePosition tentativeElementName = null;
    RulePosition savedRulePosition = null;
    RulePosition savedRulePosition2 = null;
    RulePosition savedRulePosition3 = null;
    RulePosition lastRulePosition = null;
    ForgivingStack<RulePosition> rulePositions = new ForgivingStack<RulePosition>();
    // boolean stringLiteralIsABindingName = false;
    RulePosition rulePosition;
    while ((rulePosition = scanner.nextRulePosition()) != null) {
      boolean whitespace = false;
      boolean comment = false;
      if (RulePosition.isRulePositionOfType(rulePosition, WhitespaceRule.class)) {
        whitespace = true;
      }
View Full Code Here


        // Without an underlying model, we have to rescan the line to
        // figure out exactly
        // what the current matching rule was, so we know what kind of
        // token we're dealing with.
        IRegion lineRegion = document.getLineInformationOfOffset(offset);
        WodScanner scanner = WodScanner.newWODScanner();
        scanner.setRange(document, lineRegion.getOffset(), lineRegion.getLength());
        boolean foundToken = false;
        RulePosition rulePosition = null;
        while (!foundToken && (rulePosition = scanner.nextRulePosition()) != null) {
          int tokenOffset = rulePosition.getTokenOffset();
          if (offset == lineRegion.getOffset() && offset == tokenOffset) {
            foundToken = true;
          } else if (offset > tokenOffset && offset <= rulePosition.getTokenEndOffset()) {
            foundToken = true;
          }
        }

        // We can't reliably use rulePosition here because it might be
        // null ...
        int tokenOffset = scanner.getTokenOffset();
        int tokenLength = scanner.getTokenLength();
        IRule rule = (rulePosition == null) ? null : rulePosition.getRule();
        // If you make a completion request in the middle of whitespace,
        // we don't want to select the whitespace, so zero out the
        // whitespace token offsets.
        if (rule instanceof WhitespaceRule) {
View Full Code Here

        TextSelection selection = (TextSelection) _selection;
        ITextEditor textEditor = (ITextEditor) _activeEditor;
        IEditorInput editorInput = textEditor.getEditorInput();
        IDocument document = textEditor.getDocumentProvider().getDocument(editorInput);

        WodScanner scanner = WodScanner.wodScannerForDocument(document);
        rulePosition = scanner.getRulePositionAtOffset(selection.getOffset());

        IProject project = null;
        if (editorInput instanceof FileEditorInput) {
          IFile file = ((FileEditorInput) editorInput).getFile();
          project = file.getProject();
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.wodclipse.core.parser.WodScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.