package com.intellij.lang;

import com.intellij.lexer.Lexer;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.tree.IFileElementType;
import com.intellij.psi.tree.TokenSet;
import org.jetbrains.annotations.NotNull;

/**
 * Created by IntelliJ IDEA.
 * User: max
 * Date: Jan 17, 2005
 * Time: 7:57:54 PM
 * To change this template use File | Settings | File Templates.
 */
public interface ParserDefinition {
  Lexer createLexer(Project project);
  PsiParser createParser(Project project);

  IFileElementType getFileNodeType();

  @NotNull
  TokenSet getWhitespaceTokens();
  @NotNull
  TokenSet getCommentTokens();

  PsiElement createElement(ASTNode node);
  PsiFile createFile(Project project, VirtualFile file);
  PsiFile createFile(Project project, String name, CharSequence text);
}

@@ -1,8 +1,1616 @@
+/*%0A * Copyright (c) 2000-05 JetBrains s.r.o. All  Rights Reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions%0A * are met:%0A *%0A * -Redistributions of source code must retain the above copyright%0A *  notice, this list of conditions and the following disclaimer.%0A *%0A * -Redistribution in binary form must reproduct the above copyright%0A *  notice, this list of conditions and the following disclaimer in%0A *  the documentation and/or other materials provided with the distribution.%0A *%0A * Neither the name of JetBrains or IntelliJ IDEA%0A * may be used to endorse or promote products derived from this software%0A * without specific prior written permission.%0A *%0A * This software is provided %22AS IS,%22 without a warranty of any kind. ALL%0A * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING%0A * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE%0A * OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. JETBRAINS AND ITS LICENSORS SHALL NOT%0A * BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT%0A * OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS%0A * DERIVATIVES. IN NO EVENT WILL JETBRAINS OR ITS LICENSORS BE LIABLE FOR ANY LOST%0A * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,%0A * INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY%0A * OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN%0A * IF JETBRAINS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.%0A *%0A */%0A
 package 
@@ -1961,158 +1961,75 @@
 %0A * 
-Created by IntelliJ IDEA.%0A * User: max%0A * Date: Jan 17, 2005%0A * Time: 7:57:54 PM%0A * To change this template use File %7C Settings %7C File Templates
+Defines the implementation of a parser for a custom language
 .%0A */%0A
+%0A
 publ
@@ -2066,43 +2066,527 @@
 %7B%0A  
-Lexer createLexer(Project project);
+/**%0A   * Returns the lexer for lexing files in the specified project. This lexer does not need to support incremental relexing - it is always%0A   * called for the entire file.%0A   * @param project the project to which the lexer is connected.%0A   * @return the lexer instance.%0A   */%0A  @NotNull%0A  Lexer createLexer(Project project);%0A%0A  /**%0A   * Returns the parser for parsing files in the specified project.%0A   * @param project the project to which the parser is connected.%0A   * @return the parser instance.%0A   */%0A  @NotNull
 %0A  P

update to JFlex 1.4.1; add -charat command line parameter to JFlex; include JFlex lib and sources in the -dev package; remove invalid JS lexer skeleton