Commit ed552a51 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Implement @xtype/ptype/ftype as builtin tag classes.

parent c5e351c5
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
require "jsduck/builtins/xtype"

module JsDuck::Builtins
  class Ftype < Xtype
    def initialize
      @pattern = "ftype"
    end

    # @ftype name
    def parse(p)
      p.add_tag(:alias)
      parse_alias_shorthand(p, "feature")
    end

  end
end
+16 −0
Original line number Diff line number Diff line
require "jsduck/builtins/xtype"

module JsDuck::Builtins
  class Ptype < Xtype
    def initialize
      @pattern = "ptype"
    end

    # @ptype name
    def parse(p)
      p.add_tag(:alias)
      parse_alias_shorthand(p, "plugin")
    end

  end
end
+23 −0
Original line number Diff line number Diff line
require "jsduck/builtins/tag"

module JsDuck::Builtins
  class Xtype < Tag
    def initialize
      @pattern = "xtype"
    end

    # @xtype name
    def parse(p)
      p.add_tag(:alias)
      parse_alias_shorthand(p, "widget")
    end

    # Parses the name after @ftype, @xtype or @ptype
    # and saves it with the given namespace prefix.
    def parse_alias_shorthand(p, namespace)
      p.skip_horiz_white
      p.current_tag[:name] = namespace + "." + (p.ident_chain || "")
    end

  end
end
+0 −11
Original line number Diff line number Diff line
@@ -33,10 +33,6 @@ module JsDuck
    end

    BUILTIN_TAGS = {
      "xtype" => [:at_xtype, "widget"],
      "ftype" => [:at_xtype, "feature"],
      "ptype" => [:at_xtype, "plugin"],

      "inheritdoc" => [:at_inheritdoc],
      "inheritDoc" => [:at_inheritdoc],
      "alias" => [:at_alias_or_inheritdoc],
@@ -195,13 +191,6 @@ module JsDuck
    # Routines for parsing of concrete tags...
    #

    # matches @xtype/ptype/ftype/... name
    def at_xtype(namespace)
      add_tag(:alias)
      skip_horiz_white
      @current_tag[:name] = namespace + "." + (ident_chain || "")
    end

    # For backwards compatibility decide whether the @alias was used
    # as @inheritdoc (@alias used to have the meaning of @inheritdoc
    # before).