Skip to content

Commit

Permalink
Closes #14 - Reference for default function namespace doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
ligasgr committed Aug 17, 2013
1 parent d5049e4 commit a60c1fd
Show file tree
Hide file tree
Showing 40 changed files with 932 additions and 77 deletions.
96 changes: 82 additions & 14 deletions gen/org/intellij/xquery/parser/XQueryParser.java
Expand Up @@ -195,6 +195,12 @@ else if (root_ == DECIMAL_FORMAT_DECL) {
else if (root_ == DEFAULT_COLLATION_DECL) {
result_ = DefaultCollationDecl(builder_, level_ + 1);
}
else if (root_ == DEFAULT_ELEMENT_NAMESPACE_DECL) {
result_ = DefaultElementNamespaceDecl(builder_, level_ + 1);
}
else if (root_ == DEFAULT_FUNCTION_NAMESPACE_DECL) {
result_ = DefaultFunctionNamespaceDecl(builder_, level_ + 1);
}
else if (root_ == DEFAULT_NAMESPACE_DECL) {
result_ = DefaultNamespaceDecl(builder_, level_ + 1);
}
Expand Down Expand Up @@ -384,6 +390,9 @@ else if (root_ == MODULE_DECL) {
else if (root_ == MODULE_IMPORT) {
result_ = ModuleImport(builder_, level_ + 1);
}
else if (root_ == MODULE_IMPORT_NAMESPACE) {
result_ = ModuleImportNamespace(builder_, level_ + 1);
}
else if (root_ == MODULE_IMPORT_PATH) {
result_ = ModuleImportPath(builder_, level_ + 1);
}
Expand Down Expand Up @@ -2657,23 +2666,22 @@ public static boolean DefaultCollationDecl(PsiBuilder builder_, int level_) {
}

/* ********************************************************** */
// "declare" "default" ("element" | "function") "namespace" URILiteral Separator
public static boolean DefaultNamespaceDecl(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "DefaultNamespaceDecl")) return false;
// "declare" "default" "element" "namespace" URILiteral
public static boolean DefaultElementNamespaceDecl(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "DefaultElementNamespaceDecl")) return false;
if (!nextTokenIs(builder_, K_DECLARE)) return false;
boolean result_ = false;
boolean pinned_ = false;
Marker marker_ = builder_.mark();
enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_, null);
result_ = consumeToken(builder_, K_DECLARE);
result_ = result_ && consumeToken(builder_, K_DEFAULT);
result_ = result_ && DefaultNamespaceDecl_2(builder_, level_ + 1);
result_ = result_ && consumeToken(builder_, K_ELEMENT);
pinned_ = result_; // pin = 3
result_ = result_ && report_error_(builder_, consumeToken(builder_, K_NAMESPACE));
result_ = pinned_ && report_error_(builder_, URILiteral(builder_, level_ + 1)) && result_;
result_ = pinned_ && Separator(builder_, level_ + 1) && result_;
result_ = pinned_ && URILiteral(builder_, level_ + 1) && result_;
if (result_ || pinned_) {
marker_.done(DEFAULT_NAMESPACE_DECL);
marker_.done(DEFAULT_ELEMENT_NAMESPACE_DECL);
}
else {
marker_.rollbackTo();
Expand All @@ -2682,13 +2690,56 @@ public static boolean DefaultNamespaceDecl(PsiBuilder builder_, int level_) {
return result_ || pinned_;
}

// "element" | "function"
private static boolean DefaultNamespaceDecl_2(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "DefaultNamespaceDecl_2")) return false;
/* ********************************************************** */
// "declare" "default" "function" "namespace" URILiteral
public static boolean DefaultFunctionNamespaceDecl(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "DefaultFunctionNamespaceDecl")) return false;
if (!nextTokenIs(builder_, K_DECLARE)) return false;
boolean result_ = false;
boolean pinned_ = false;
Marker marker_ = builder_.mark();
result_ = consumeToken(builder_, K_ELEMENT);
if (!result_) result_ = consumeToken(builder_, K_FUNCTION);
enterErrorRecordingSection(builder_, level_, _SECTION_GENERAL_, null);
result_ = consumeToken(builder_, K_DECLARE);
result_ = result_ && consumeToken(builder_, K_DEFAULT);
result_ = result_ && consumeToken(builder_, K_FUNCTION);
pinned_ = result_; // pin = 3
result_ = result_ && report_error_(builder_, consumeToken(builder_, K_NAMESPACE));
result_ = pinned_ && URILiteral(builder_, level_ + 1) && result_;
if (result_ || pinned_) {
marker_.done(DEFAULT_FUNCTION_NAMESPACE_DECL);
}
else {
marker_.rollbackTo();
}
result_ = exitErrorRecordingSection(builder_, level_, result_, pinned_, _SECTION_GENERAL_, null);
return result_ || pinned_;
}

/* ********************************************************** */
// (DefaultFunctionNamespaceDecl | DefaultElementNamespaceDecl) Separator
public static boolean DefaultNamespaceDecl(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "DefaultNamespaceDecl")) return false;
if (!nextTokenIs(builder_, K_DECLARE)) return false;
boolean result_ = false;
Marker marker_ = builder_.mark();
result_ = DefaultNamespaceDecl_0(builder_, level_ + 1);
result_ = result_ && Separator(builder_, level_ + 1);
if (result_) {
marker_.done(DEFAULT_NAMESPACE_DECL);
}
else {
marker_.rollbackTo();
}
return result_;
}

// DefaultFunctionNamespaceDecl | DefaultElementNamespaceDecl
private static boolean DefaultNamespaceDecl_0(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "DefaultNamespaceDecl_0")) return false;
boolean result_ = false;
Marker marker_ = builder_.mark();
result_ = DefaultFunctionNamespaceDecl(builder_, level_ + 1);
if (!result_) result_ = DefaultElementNamespaceDecl(builder_, level_ + 1);
if (!result_) {
marker_.rollbackTo();
}
Expand Down Expand Up @@ -5204,7 +5255,7 @@ private static boolean ModuleDeclRecover_0(PsiBuilder builder_, int level_) {
}

/* ********************************************************** */
// "import" "module" ("namespace" NamespaceName "=")? ModuleImportPath ("at" ModuleImportPath ("," ModuleImportPath)*)? Separator
// "import" "module" ("namespace" NamespaceName "=")? ModuleImportNamespace ("at" ModuleImportPath ("," ModuleImportPath)*)? Separator
public static boolean ModuleImport(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ModuleImport")) return false;
if (!nextTokenIs(builder_, K_IMPORT)) return false;
Expand All @@ -5216,7 +5267,7 @@ public static boolean ModuleImport(PsiBuilder builder_, int level_) {
result_ = result_ && consumeToken(builder_, K_MODULE);
pinned_ = result_; // pin = 2
result_ = result_ && report_error_(builder_, ModuleImport_2(builder_, level_ + 1));
result_ = pinned_ && report_error_(builder_, ModuleImportPath(builder_, level_ + 1)) && result_;
result_ = pinned_ && report_error_(builder_, ModuleImportNamespace(builder_, level_ + 1)) && result_;
result_ = pinned_ && report_error_(builder_, ModuleImport_4(builder_, level_ + 1)) && result_;
result_ = pinned_ && Separator(builder_, level_ + 1) && result_;
if (result_ || pinned_) {
Expand Down Expand Up @@ -5309,6 +5360,23 @@ private static boolean ModuleImport_4_0_2_0(PsiBuilder builder_, int level_) {
return result_;
}

/* ********************************************************** */
// ModuleImportPath
public static boolean ModuleImportNamespace(PsiBuilder builder_, int level_) {
if (!recursion_guard_(builder_, level_, "ModuleImportNamespace")) return false;
if (!nextTokenIs(builder_, STRINGLITERAL)) return false;
boolean result_ = false;
Marker marker_ = builder_.mark();
result_ = ModuleImportPath(builder_, level_ + 1);
if (result_) {
marker_.done(MODULE_IMPORT_NAMESPACE);
}
else {
marker_.rollbackTo();
}
return result_;
}

/* ********************************************************** */
// URILiteral
public static boolean ModuleImportPath(PsiBuilder builder_, int level_) {
Expand Down
29 changes: 29 additions & 0 deletions gen/org/intellij/xquery/psi/XQueryDefaultElementNamespaceDecl.java
@@ -0,0 +1,29 @@
/*
* Copyright 2013 Grzegorz Ligas <ligasgr@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// This is a generated file. Not intended for manual editing.
package org.intellij.xquery.psi;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;

public interface XQueryDefaultElementNamespaceDecl extends XQueryElement {

@Nullable
XQueryURILiteral getURILiteral();

}
@@ -0,0 +1,29 @@
/*
* Copyright 2013 Grzegorz Ligas <ligasgr@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// This is a generated file. Not intended for manual editing.
package org.intellij.xquery.psi;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;

public interface XQueryDefaultFunctionNamespaceDecl extends XQueryElement {

@Nullable
XQueryURILiteral getURILiteral();

}
7 changes: 5 additions & 2 deletions gen/org/intellij/xquery/psi/XQueryDefaultNamespaceDecl.java
Expand Up @@ -24,9 +24,12 @@
public interface XQueryDefaultNamespaceDecl extends XQueryElement {

@Nullable
XQuerySeparator getSeparator();
XQueryDefaultElementNamespaceDecl getDefaultElementNamespaceDecl();

@Nullable
XQueryURILiteral getURILiteral();
XQueryDefaultFunctionNamespaceDecl getDefaultFunctionNamespaceDecl();

@NotNull
XQuerySeparator getSeparator();

}
3 changes: 3 additions & 0 deletions gen/org/intellij/xquery/psi/XQueryModuleImport.java
Expand Up @@ -23,6 +23,9 @@

public interface XQueryModuleImport extends XQueryElement {

@Nullable
XQueryModuleImportNamespace getModuleImportNamespace();

@NotNull
List<XQueryModuleImportPath> getModuleImportPathList();

Expand Down
29 changes: 29 additions & 0 deletions gen/org/intellij/xquery/psi/XQueryModuleImportNamespace.java
@@ -0,0 +1,29 @@
/*
* Copyright 2013 Grzegorz Ligas <ligasgr@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// This is a generated file. Not intended for manual editing.
package org.intellij.xquery.psi;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;

public interface XQueryModuleImportNamespace extends XQueryElement {

@NotNull
XQueryModuleImportPath getModuleImportPath();

}
12 changes: 12 additions & 0 deletions gen/org/intellij/xquery/psi/XQueryTypes.java
Expand Up @@ -75,6 +75,8 @@ public interface XQueryTypes {
IElementType C_DATA_SECTION_CONTENTS = new XQueryElementType("C_DATA_SECTION_CONTENTS");
IElementType DECIMAL_FORMAT_DECL = new XQueryElementType("DECIMAL_FORMAT_DECL");
IElementType DEFAULT_COLLATION_DECL = new XQueryElementType("DEFAULT_COLLATION_DECL");
IElementType DEFAULT_ELEMENT_NAMESPACE_DECL = new XQueryElementType("DEFAULT_ELEMENT_NAMESPACE_DECL");
IElementType DEFAULT_FUNCTION_NAMESPACE_DECL = new XQueryElementType("DEFAULT_FUNCTION_NAMESPACE_DECL");
IElementType DEFAULT_NAMESPACE_DECL = new XQueryElementType("DEFAULT_NAMESPACE_DECL");
IElementType DF_PROPERTY_NAME = new XQueryElementType("DF_PROPERTY_NAME");
IElementType DIRECT_CONSTRUCTOR = new XQueryElementType("DIRECT_CONSTRUCTOR");
Expand Down Expand Up @@ -139,6 +141,7 @@ public interface XQueryTypes {
IElementType MODULE = new XQueryElementType("MODULE");
IElementType MODULE_DECL = new XQueryElementType("MODULE_DECL");
IElementType MODULE_IMPORT = new XQueryElementType("MODULE_IMPORT");
IElementType MODULE_IMPORT_NAMESPACE = new XQueryElementType("MODULE_IMPORT_NAMESPACE");
IElementType MODULE_IMPORT_PATH = new XQueryElementType("MODULE_IMPORT_PATH");
IElementType MULTIPLICATIVE_EXPR = new XQueryElementType("MULTIPLICATIVE_EXPR");
IElementType NAMED_FUNCTION_REF = new XQueryElementType("NAMED_FUNCTION_REF");
Expand Down Expand Up @@ -587,6 +590,12 @@ else if (type == DECIMAL_FORMAT_DECL) {
else if (type == DEFAULT_COLLATION_DECL) {
return new XQueryDefaultCollationDeclImpl(node);
}
else if (type == DEFAULT_ELEMENT_NAMESPACE_DECL) {
return new XQueryDefaultElementNamespaceDeclImpl(node);
}
else if (type == DEFAULT_FUNCTION_NAMESPACE_DECL) {
return new XQueryDefaultFunctionNamespaceDeclImpl(node);
}
else if (type == DEFAULT_NAMESPACE_DECL) {
return new XQueryDefaultNamespaceDeclImpl(node);
}
Expand Down Expand Up @@ -779,6 +788,9 @@ else if (type == MODULE_DECL) {
else if (type == MODULE_IMPORT) {
return new XQueryModuleImportImpl(node);
}
else if (type == MODULE_IMPORT_NAMESPACE) {
return new XQueryModuleImportNamespaceImpl(node);
}
else if (type == MODULE_IMPORT_PATH) {
return new XQueryModuleImportPathImpl(node);
}
Expand Down
12 changes: 12 additions & 0 deletions gen/org/intellij/xquery/psi/XQueryVisitor.java
Expand Up @@ -230,6 +230,14 @@ public void visitDefaultCollationDecl(@NotNull XQueryDefaultCollationDecl o) {
visitElement(o);
}

public void visitDefaultElementNamespaceDecl(@NotNull XQueryDefaultElementNamespaceDecl o) {
visitElement(o);
}

public void visitDefaultFunctionNamespaceDecl(@NotNull XQueryDefaultFunctionNamespaceDecl o) {
visitElement(o);
}

public void visitDefaultNamespaceDecl(@NotNull XQueryDefaultNamespaceDecl o) {
visitElement(o);
}
Expand Down Expand Up @@ -482,6 +490,10 @@ public void visitModuleImport(@NotNull XQueryModuleImport o) {
visitElement(o);
}

public void visitModuleImportNamespace(@NotNull XQueryModuleImportNamespace o) {
visitElement(o);
}

public void visitModuleImportPath(@NotNull XQueryModuleImportPath o) {
visitElement(o);
}
Expand Down
@@ -0,0 +1,46 @@
/*
* Copyright 2013 Grzegorz Ligas <ligasgr@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// This is a generated file. Not intended for manual editing.
package org.intellij.xquery.psi.impl;

import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static org.intellij.xquery.psi.XQueryTypes.*;
import org.intellij.xquery.psi.*;

public class XQueryDefaultElementNamespaceDeclImpl extends XQueryElementImpl implements XQueryDefaultElementNamespaceDecl {

public XQueryDefaultElementNamespaceDeclImpl(ASTNode node) {
super(node);
}

@Override
@Nullable
public XQueryURILiteral getURILiteral() {
return findChildByClass(XQueryURILiteral.class);
}

public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof XQueryVisitor) ((XQueryVisitor)visitor).visitDefaultElementNamespaceDecl(this);
else super.accept(visitor);
}

}

0 comments on commit a60c1fd

Please sign in to comment.